PD: improve task panel for revolution/groove:

* set range Angle property to spin box
* connect signals after initializing widgets to avoid superfluous recomputes
This commit is contained in:
wmayer
2021-03-03 15:42:48 +01:00
parent 6364a4cb7d
commit 70ca3580a1
2 changed files with 18 additions and 29 deletions

View File

@@ -65,26 +65,8 @@ TaskRevolutionParameters::TaskRevolutionParameters(PartDesignGui::ViewProvider*
proxy = new QWidget(this);
ui->setupUi(proxy);
QMetaObject::connectSlotsByName(this);
connect(ui->revolveAngle, SIGNAL(valueChanged(double)),
this, SLOT(onAngleChanged(double)));
connect(ui->axis, SIGNAL(activated(int)),
this, SLOT(onAxisChanged(int)));
connect(ui->checkBoxMidplane, SIGNAL(toggled(bool)),
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->revolveAngle->blockSignals(true);
ui->axis->blockSignals(true);
ui->checkBoxMidplane->blockSignals(true);
ui->checkBoxReversed->blockSignals(true);
//bind property mirrors
PartDesign::ProfileBased* pcFeat = static_cast<PartDesign::ProfileBased*>(vp->getObject());
if (pcFeat->isDerivedFrom(PartDesign::Revolution::getClassTypeId())) {
@@ -104,8 +86,8 @@ TaskRevolutionParameters::TaskRevolutionParameters(PartDesignGui::ViewProvider*
ui->revolveAngle->bind(rev->Angle);
}
bool mirrored = propMidPlane->getValue();
bool reversed = propReversed->getValue();
ui->checkBoxMidplane->setChecked(propMidPlane->getValue());
ui->checkBoxReversed->setChecked(propReversed->getValue());
ui->revolveAngle->setValue(propAngle->getValue());
ui->revolveAngle->setMaximum(propAngle->getMaximum());
@@ -113,15 +95,7 @@ TaskRevolutionParameters::TaskRevolutionParameters(PartDesignGui::ViewProvider*
blockUpdate = false;
updateUI();
ui->checkBoxMidplane->setChecked(mirrored);
ui->checkBoxReversed->setChecked(reversed);
ui->revolveAngle->blockSignals(false);
ui->axis->blockSignals(false);
ui->checkBoxMidplane->blockSignals(false);
ui->checkBoxReversed->blockSignals(false);
connectSignals();
setFocus ();
@@ -221,6 +195,20 @@ void TaskRevolutionParameters::addAxisToCombo(App::DocumentObject* linkObj,
lnk.setValue(linkObj,std::vector<std::string>(1,linkSubname));
}
void TaskRevolutionParameters::connectSignals()
{
connect(ui->revolveAngle, SIGNAL(valueChanged(double)),
this, SLOT(onAngleChanged(double)));
connect(ui->axis, SIGNAL(activated(int)),
this, SLOT(onAxisChanged(int)));
connect(ui->checkBoxMidplane, SIGNAL(toggled(bool)),
this, SLOT(onMidplane(bool)));
connect(ui->checkBoxReversed, SIGNAL(toggled(bool)),
this, SLOT(onReversed(bool)));
connect(ui->checkBoxUpdateView, SIGNAL(toggled(bool)),
this, SLOT(onUpdateView(bool)));
}
void TaskRevolutionParameters::updateUI()
{
if (blockUpdate)

View File

@@ -88,6 +88,7 @@ protected:
App::PropertyLinkSub* propReferenceAxis;
private:
void connectSignals();
void updateUI();
private: