diff --git a/src/Mod/PartDesign/Gui/TaskGrooveParameters.cpp b/src/Mod/PartDesign/Gui/TaskGrooveParameters.cpp index 974e1e288..8ec594037 100644 --- a/src/Mod/PartDesign/Gui/TaskGrooveParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskGrooveParameters.cpp @@ -64,9 +64,17 @@ TaskGrooveParameters::TaskGrooveParameters(ViewProviderGroove *GrooveView,QWidge this, SLOT(onMidplane(bool))); connect(ui->checkBoxReversed, SIGNAL(toggled(bool)), this, SLOT(onReversed(bool))); + connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)), + this, SLOT(onUpdateView(bool))); this->groupLayout()->addWidget(proxy); + // Temporarily prevent unnecessary feature updates + ui->doubleSpinBox->blockSignals(true); + ui->axis->blockSignals(true); + ui->checkBoxMidplane->blockSignals(true); + ui->checkBoxReversed->blockSignals(true); + PartDesign::Groove* pcGroove = static_cast(GrooveView->getObject()); double l = pcGroove->Angle.getValue(); bool mirrored = pcGroove->Midplane.getValue(); @@ -105,6 +113,11 @@ TaskGrooveParameters::TaskGrooveParameters(ViewProviderGroove *GrooveView,QWidge ui->checkBoxMidplane->setChecked(mirrored); ui->checkBoxReversed->setChecked(reversed); + ui->doubleSpinBox->blockSignals(false); + ui->axis->blockSignals(false); + ui->checkBoxMidplane->blockSignals(false); + ui->checkBoxReversed->blockSignals(false); + setFocus (); } @@ -112,7 +125,8 @@ void TaskGrooveParameters::onAngleChanged(double len) { PartDesign::Groove* pcGroove = static_cast(GrooveView->getObject()); pcGroove->Angle.setValue((float)len); - pcGroove->getDocument()->recomputeFeature(pcGroove); + if (updateView()) + pcGroove->getDocument()->recomputeFeature(pcGroove); } void TaskGrooveParameters::onAxisChanged(int num) @@ -133,23 +147,33 @@ void TaskGrooveParameters::onAxisChanged(int num) if (num < maxcount && ui->axis->count() > maxcount) ui->axis->setMaxCount(maxcount); } - pcGroove->getDocument()->recomputeFeature(pcGroove); + if (updateView()) + pcGroove->getDocument()->recomputeFeature(pcGroove); } void TaskGrooveParameters::onMidplane(bool on) { PartDesign::Groove* pcGroove = static_cast(GrooveView->getObject()); pcGroove->Midplane.setValue(on); - pcGroove->getDocument()->recomputeFeature(pcGroove); + if (updateView()) + pcGroove->getDocument()->recomputeFeature(pcGroove); } void TaskGrooveParameters::onReversed(bool on) { PartDesign::Groove* pcGroove = static_cast(GrooveView->getObject()); pcGroove->Reversed.setValue(on); - pcGroove->getDocument()->recomputeFeature(pcGroove); + if (updateView()) + pcGroove->getDocument()->recomputeFeature(pcGroove); } +void TaskGrooveParameters::onUpdateView(bool on) +{ + if (on) { + PartDesign::Groove* pcGroove = static_cast(GrooveView->getObject()); + pcGroove->getDocument()->recomputeFeature(pcGroove); + } +} double TaskGrooveParameters::getAngle(void) const { @@ -191,6 +215,11 @@ bool TaskGrooveParameters::getReversed(void) const return ui->checkBoxReversed->isChecked(); } +const bool TaskGrooveParameters::updateView() const +{ + return ui->checkBoxUpdateView->isChecked(); +} + TaskGrooveParameters::~TaskGrooveParameters() { delete ui; diff --git a/src/Mod/PartDesign/Gui/TaskGrooveParameters.h b/src/Mod/PartDesign/Gui/TaskGrooveParameters.h index 1c19bb6b6..7afaaf1f7 100644 --- a/src/Mod/PartDesign/Gui/TaskGrooveParameters.h +++ b/src/Mod/PartDesign/Gui/TaskGrooveParameters.h @@ -56,12 +56,14 @@ public: double getAngle(void) const; bool getMidplane(void) const; bool getReversed(void) const; + const bool updateView() const; private Q_SLOTS: void onAngleChanged(double); void onAxisChanged(int); void onMidplane(bool); void onReversed(bool); + void onUpdateView(bool); protected: void changeEvent(QEvent *e); diff --git a/src/Mod/PartDesign/Gui/TaskGrooveParameters.ui b/src/Mod/PartDesign/Gui/TaskGrooveParameters.ui index d7a68d6c2..294901622 100644 --- a/src/Mod/PartDesign/Gui/TaskGrooveParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskGrooveParameters.ui @@ -7,7 +7,7 @@ 0 0 278 - 158 + 195 @@ -86,6 +86,23 @@ + + + + Qt::Horizontal + + + + + + + Update view + + + true + + + diff --git a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp index f78134b74..71bd26745 100644 --- a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp +++ b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp @@ -64,9 +64,17 @@ TaskRevolutionParameters::TaskRevolutionParameters(ViewProviderRevolution *Revol this, SLOT(onMidplane(bool))); connect(ui->checkBoxReversed, SIGNAL(toggled(bool)), this, SLOT(onReversed(bool))); + connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)), + this, SLOT(onUpdateView(bool))); this->groupLayout()->addWidget(proxy); + // Temporarily prevent unnecessary feature recomputes + ui->doubleSpinBox->blockSignals(true); + ui->axis->blockSignals(true); + ui->checkBoxMidplane->blockSignals(true); + ui->checkBoxReversed->blockSignals(true); + PartDesign::Revolution* pcRevolution = static_cast(RevolutionView->getObject()); double l = pcRevolution->Angle.getValue(); bool mirrored = pcRevolution->Midplane.getValue(); @@ -105,6 +113,11 @@ TaskRevolutionParameters::TaskRevolutionParameters(ViewProviderRevolution *Revol ui->checkBoxMidplane->setChecked(mirrored); ui->checkBoxReversed->setChecked(reversed); + ui->doubleSpinBox->blockSignals(false); + ui->axis->blockSignals(false); + ui->checkBoxMidplane->blockSignals(false); + ui->checkBoxReversed->blockSignals(false); + setFocus (); } @@ -112,7 +125,8 @@ void TaskRevolutionParameters::onAngleChanged(double len) { PartDesign::Revolution* pcRevolution = static_cast(RevolutionView->getObject()); pcRevolution->Angle.setValue((float)len); - pcRevolution->getDocument()->recomputeFeature(pcRevolution); + if (updateView()) + pcRevolution->getDocument()->recomputeFeature(pcRevolution); } void TaskRevolutionParameters::onAxisChanged(int num) @@ -133,21 +147,32 @@ void TaskRevolutionParameters::onAxisChanged(int num) if (num < maxcount && ui->axis->count() > maxcount) ui->axis->setMaxCount(maxcount); } - pcRevolution->getDocument()->recomputeFeature(pcRevolution); + if (updateView()) + pcRevolution->getDocument()->recomputeFeature(pcRevolution); } void TaskRevolutionParameters::onMidplane(bool on) { PartDesign::Revolution* pcRevolution = static_cast(RevolutionView->getObject()); pcRevolution->Midplane.setValue(on); - pcRevolution->getDocument()->recomputeFeature(pcRevolution); + if (updateView()) + pcRevolution->getDocument()->recomputeFeature(pcRevolution); } void TaskRevolutionParameters::onReversed(bool on) { PartDesign::Revolution* pcRevolution = static_cast(RevolutionView->getObject()); pcRevolution->Reversed.setValue(on); - pcRevolution->getDocument()->recomputeFeature(pcRevolution); + if (updateView()) + pcRevolution->getDocument()->recomputeFeature(pcRevolution); +} + +void TaskRevolutionParameters::onUpdateView(bool on) +{ + if (on) { + PartDesign::Revolution* pcRevolution = static_cast(RevolutionView->getObject()); + pcRevolution->getDocument()->recomputeFeature(pcRevolution); + } } double TaskRevolutionParameters::getAngle(void) const @@ -190,6 +215,11 @@ bool TaskRevolutionParameters::getReversed(void) const return ui->checkBoxReversed->isChecked(); } +const bool TaskRevolutionParameters::updateView() const +{ + return ui->checkBoxUpdateView->isChecked(); +} + TaskRevolutionParameters::~TaskRevolutionParameters() { delete ui; diff --git a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.h b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.h index 1d9eb71a8..6b0d9eec7 100644 --- a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.h +++ b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.h @@ -53,15 +53,17 @@ public: ~TaskRevolutionParameters(); QString getReferenceAxis(void) const; - double getAngle(void) const; - bool getMidplane(void) const; - bool getReversed(void) const; + double getAngle(void) const; + bool getMidplane(void) const; + bool getReversed(void) const; + const bool updateView() const; private Q_SLOTS: void onAngleChanged(double); void onAxisChanged(int); void onMidplane(bool); void onReversed(bool); + void onUpdateView(bool); protected: void changeEvent(QEvent *e); diff --git a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.ui b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.ui index dac292f99..bef4562c9 100644 --- a/src/Mod/PartDesign/Gui/TaskRevolutionParameters.ui +++ b/src/Mod/PartDesign/Gui/TaskRevolutionParameters.ui @@ -7,7 +7,7 @@ 0 0 278 - 158 + 193 @@ -86,6 +86,23 @@ + + + + Qt::Horizontal + + + + + + + Update view + + + true + + +