avoid to create a circular dependency when modifying an existing pad or pocket operation

This commit is contained in:
wmayer
2016-12-28 17:05:20 +01:00
parent a421803c09
commit af314cd04f
3 changed files with 24 additions and 5 deletions

View File

@@ -32,6 +32,7 @@
#include <Mod/PartDesign/App/Body.h>
#include "TaskFeatureParameters.h"
#include "TaskSketchBasedParameters.h"
using namespace PartDesignGui;
using namespace Gui;
@@ -107,6 +108,15 @@ bool TaskDlgFeatureParameters::accept() {
throw Base::Exception(vp->getObject()->getStatusString());
}
// detach the task panel from the selection to avoid to invoke
// eventually onAddSelection when the selection changes
std::vector<QWidget*> subwidgets = getDialogContent();
for (auto it : subwidgets) {
TaskSketchBasedParameters* param = qobject_cast<TaskSketchBasedParameters*>(it);
if (param)
param->detachSelection();
}
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
Gui::Command::commitCommand();
} catch (const Base::Exception& e) {
@@ -128,6 +138,15 @@ bool TaskDlgFeatureParameters::reject()
// (at least in the body case)
App::DocumentObject* previous = feature->getBaseObject(/* silent = */ true );
// detach the task panel from the selection to avoid to invoke
// eventually onAddSelection when the selection changes
std::vector<QWidget*> subwidgets = getDialogContent();
for (auto it : subwidgets) {
TaskSketchBasedParameters* param = qobject_cast<TaskSketchBasedParameters*>(it);
if (param)
param->detachSelection();
}
// roll back the done things
Gui::Command::abortCommand();
Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");