Part: section cut window is not bound to 3d viewer widget

This commit is contained in:
wmayer
2022-02-13 19:33:19 +01:00
parent a43276cce1
commit b0d8ed1bf2
3 changed files with 5 additions and 27 deletions

View File

@@ -2501,33 +2501,13 @@ void CmdPartSectionCut::activated(int iMsg)
Q_UNUSED(iMsg);
static QPointer<PartGui::SectionCut> sectionCut = nullptr;
if (!sectionCut) {
Gui::View3DInventor* view = qobject_cast<Gui::View3DInventor*>(Gui::getMainWindow()->activeWindow());
if (view) {
sectionCut = PartGui::SectionCut::makeDockWidget(view);
}
sectionCut = PartGui::SectionCut::makeDockWidget(Gui::getMainWindow());
}
}
bool CmdPartSectionCut::isActive(void)
{
#if 0
Gui::View3DInventor* view = qobject_cast<View3DInventor*>(Gui::getMainWindow()->activeWindow());
if (view) {
Gui::Action* action = qobject_cast<Action*>(_pcAction);
if (action->isChecked() != view->hasClippingPlane())
action->setChecked(view->hasClippingPlane());
return true;
}
else {
Gui::Action* action = qobject_cast<Action*>(_pcAction);
if (action->isChecked())
action->setChecked(false);
return false;
}
#else
Gui::View3DInventor* view = qobject_cast<Gui::View3DInventor*>(Gui::getMainWindow()->activeWindow());
return view ? true : false;
#endif
return hasActiveDocument();
}
//---------------------------------------------------------------

View File

@@ -663,10 +663,10 @@ void SectionCut::startCutting(bool isInitial)
}
}
SectionCut* SectionCut::makeDockWidget(Gui::View3DInventor* view)
SectionCut* SectionCut::makeDockWidget(QWidget* parent)
{
// embed this dialog into a QDockWidget
SectionCut* sectionCut = new SectionCut(view);
SectionCut* sectionCut = new SectionCut(parent);
Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance();
// the dialog is designed that you can see the tree, thus put it to the right side
QDockWidget* dw = pDockMgr->addDockWindow("Section Cutting", sectionCut, Qt::RightDockWidgetArea);

View File

@@ -26,8 +26,6 @@
#include <QDialog>
#include <App/DocumentObject.h>
namespace Gui { class View3DInventor; }
namespace PartGui {
class Ui_SectionCut;
@@ -37,7 +35,7 @@ class SectionCut : public QDialog
Q_OBJECT
public:
static SectionCut* makeDockWidget(Gui::View3DInventor*);
static SectionCut* makeDockWidget(QWidget* parent = nullptr);
SectionCut(QWidget* parent = nullptr);
~SectionCut();