PartDesign: make MultiTransform honour the "Update view" checkbox when adding transformations

This commit is contained in:
jrheinlaender 2012-09-14 00:16:43 +02:00 committed by logari81
parent e5d1643878
commit 08043f46c2
4 changed files with 16 additions and 8 deletions

View File

@ -101,6 +101,8 @@ TaskMultiTransformParameters::TaskMultiTransformParameters(ViewProviderTransform
this, SLOT(onMoveDown()));
ui->listTransformFeatures->addAction(action);
ui->listTransformFeatures->setContextMenuPolicy(Qt::ActionsContextMenu);
connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)),
this, SLOT(onUpdateView(bool)));
connect(ui->listTransformFeatures, SIGNAL(activated(QModelIndex)),
this, SLOT(onTransformActivated(QModelIndex)));
@ -214,7 +216,7 @@ void TaskMultiTransformParameters::onTransformAddMirrored()
Gui::Command::openCommand("Mirrored");
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject(\"PartDesign::Mirrored\",\"%s\")",newFeatName.c_str());
Gui::Command::updateActive();
//Gui::Command::updateActive();
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.StdMirrorPlane = \"XY\"", newFeatName.c_str());
finishAdd(newFeatName);
@ -227,7 +229,7 @@ void TaskMultiTransformParameters::onTransformAddLinearPattern()
Gui::Command::openCommand("LinearPattern");
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject(\"PartDesign::LinearPattern\",\"%s\")",newFeatName.c_str());
Gui::Command::updateActive();
//Gui::Command::updateActive();
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.StdDirection = \"X\"", newFeatName.c_str());
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Length = 100", newFeatName.c_str());
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Occurrences = 2", newFeatName.c_str());
@ -242,7 +244,7 @@ void TaskMultiTransformParameters::onTransformAddPolarPattern()
Gui::Command::openCommand("PolarPattern");
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject(\"PartDesign::PolarPattern\",\"%s\")",newFeatName.c_str());
Gui::Command::updateActive();
//Gui::Command::updateActive();
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.StdAxis = \"X\"", newFeatName.c_str());
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Angle = 360", newFeatName.c_str());
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Occurrences = 2", newFeatName.c_str());
@ -257,7 +259,7 @@ void TaskMultiTransformParameters::onTransformAddScaled()
Gui::Command::openCommand("Scaled");
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().addObject(\"PartDesign::Scaled\",\"%s\")",newFeatName.c_str());
Gui::Command::updateActive();
//Gui::Command::updateActive();
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Factor = 2", newFeatName.c_str());
Gui::Command::doCommand(Gui::Command::Doc,"App.activeDocument().%s.Occurrences = 2", newFeatName.c_str());
@ -357,6 +359,13 @@ void TaskMultiTransformParameters::onSubTaskButtonOK() {
closeSubTask();
}
void TaskMultiTransformParameters::onUpdateView(bool on)
{
blockUpdate = !on;
if (on)
recomputeFeature();
}
const std::vector<App::DocumentObject*> TaskMultiTransformParameters::getTransformFeatures(void) const
{
PartDesign::MultiTransform* pcMultiTransform = static_cast<PartDesign::MultiTransform*>(TransformedView->getObject());

View File

@ -76,6 +76,7 @@ private Q_SLOTS:
virtual void onSubTaskButtonOK();
// Note: There is no Cancel button because I couldn't work out how to save the state of
// a subFeature so as to revert the changes of an edit operation
virtual void onUpdateView(bool);
protected:
virtual void changeEvent(QEvent *e);

View File

@ -110,7 +110,7 @@ void TaskTransformedParameters::recomputeFeature()
if (insideMultiTransform) {
// redirect recompute and let the parent decide if recompute has to be blocked
parentTask->recomputeFeature();
} else if (!blockRecompute) {
} else if (!blockUpdate) {
PartDesign::Transformed* pcTransformed = static_cast<PartDesign::Transformed*>(TransformedView->getObject());
pcTransformed->getDocument()->recomputeFeature(pcTransformed);
}

View File

@ -94,10 +94,8 @@ protected:
TaskMultiTransformParameters* parentTask;
/// Flag indicating whether this object is a container for MultiTransform
bool insideMultiTransform;
/// Lock updateUI() and applying changes to the underlying feature
/// Lock updateUI(), applying changes to the underlying feature and calling recomputeFeature()
bool blockUpdate;
/// Lock recomputeFeature()
bool blockRecompute;
};
/// simulation dialog for the TaskView