Skip to content

Commit

Permalink
+ support units in revolve panel
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Jul 22, 2014
1 parent 4b644b2 commit 67b85ff
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
3 changes: 0 additions & 3 deletions src/Mod/PartDesign/Gui/TaskGrooveParameters.ui
Expand Up @@ -65,9 +65,6 @@
<property name="value">
<double>360.000000000000000</double>
</property>
<property name="decimals" stdset="0">
<number>1</number>
</property>
</widget>
</item>
</layout>
Expand Down
19 changes: 11 additions & 8 deletions src/Mod/PartDesign/Gui/TaskRevolutionParameters.cpp
Expand Up @@ -57,7 +57,7 @@ TaskRevolutionParameters::TaskRevolutionParameters(ViewProviderRevolution *Revol
ui->setupUi(proxy);
QMetaObject::connectSlotsByName(this);

connect(ui->doubleSpinBox, SIGNAL(valueChanged(double)),
connect(ui->revolveAngle, SIGNAL(valueChanged(double)),
this, SLOT(onAngleChanged(double)));
connect(ui->axis, SIGNAL(activated(int)),
this, SLOT(onAxisChanged(int)));
Expand All @@ -71,7 +71,7 @@ TaskRevolutionParameters::TaskRevolutionParameters(ViewProviderRevolution *Revol
this->groupLayout()->addWidget(proxy);

// Temporarily prevent unnecessary feature recomputes
ui->doubleSpinBox->blockSignals(true);
ui->revolveAngle->blockSignals(true);
ui->axis->blockSignals(true);
ui->checkBoxMidplane->blockSignals(true);
ui->checkBoxReversed->blockSignals(true);
Expand All @@ -81,8 +81,7 @@ TaskRevolutionParameters::TaskRevolutionParameters(ViewProviderRevolution *Revol
bool mirrored = pcRevolution->Midplane.getValue();
bool reversed = pcRevolution->Reversed.getValue();

ui->doubleSpinBox->setDecimals(Base::UnitsApi::getDecimals());
ui->doubleSpinBox->setValue(l);
ui->revolveAngle->setValue(l);

int count=pcRevolution->getSketchAxisCount();

Expand Down Expand Up @@ -115,7 +114,7 @@ TaskRevolutionParameters::TaskRevolutionParameters(ViewProviderRevolution *Revol
ui->checkBoxMidplane->setChecked(mirrored);
ui->checkBoxReversed->setChecked(reversed);

ui->doubleSpinBox->blockSignals(false);
ui->revolveAngle->blockSignals(false);
ui->axis->blockSignals(false);
ui->checkBoxMidplane->blockSignals(false);
ui->checkBoxReversed->blockSignals(false);
Expand Down Expand Up @@ -188,14 +187,14 @@ void TaskRevolutionParameters::onReversed(bool on)
void TaskRevolutionParameters::onUpdateView(bool on)
{
if (on) {
PartDesign::Revolution* pcRevolution = static_cast<PartDesign::Revolution*>(RevolutionView->getObject());
PartDesign::Revolution* pcRevolution = static_cast<PartDesign::Revolution*>(RevolutionView->getObject());
pcRevolution->getDocument()->recomputeFeature(pcRevolution);
}
}

double TaskRevolutionParameters::getAngle(void) const
{
return ui->doubleSpinBox->value();
return ui->revolveAngle->value().getValue();
}

QString TaskRevolutionParameters::getReferenceAxis(void) const
Expand Down Expand Up @@ -275,7 +274,11 @@ TaskDlgRevolutionParameters::~TaskDlgRevolutionParameters()

void TaskDlgRevolutionParameters::open()
{

// a transaction is already open at creation time of the pad
if (!Gui::Command::hasPendingCommand()) {
QString msg = QObject::tr("Edit revolve");
Gui::Command::openCommand((const char*)msg.toUtf8());
}
}

void TaskDlgRevolutionParameters::clicked(int)
Expand Down
13 changes: 10 additions & 3 deletions src/Mod/PartDesign/Gui/TaskRevolutionParameters.ui
Expand Up @@ -49,9 +49,9 @@
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox">
<property name="decimals">
<number>1</number>
<widget class="Gui::QuantitySpinBox" name="revolveAngle">
<property name="unit" stdset="0">
<string>deg</string>
</property>
<property name="minimum">
<double>0.000000000000000</double>
Expand Down Expand Up @@ -105,6 +105,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

0 comments on commit 67b85ff

Please sign in to comment.