PartDesign: add UpdateView option for Revolution and Groove
This commit is contained in:
parent
399f92b4e5
commit
883259d146
|
@ -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<PartDesign::Groove*>(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<PartDesign::Groove*>(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<PartDesign::Groove*>(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<PartDesign::Groove*>(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<PartDesign::Groove*>(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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>278</width>
|
||||
<height>158</height>
|
||||
<height>195</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -86,6 +86,23 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxUpdateView">
|
||||
<property name="text">
|
||||
<string>Update view</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
|
|
@ -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<PartDesign::Revolution*>(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<PartDesign::Revolution*>(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<PartDesign::Revolution*>(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<PartDesign::Revolution*>(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<PartDesign::Revolution*>(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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>278</width>
|
||||
<height>158</height>
|
||||
<height>193</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
|
@ -86,6 +86,23 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBoxUpdateView">
|
||||
<property name="text">
|
||||
<string>Update view</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
|
|
Loading…
Reference in New Issue
Block a user