Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
+ fixes #1562: Add units to Fillet and Chamfer in PartDesign
  • Loading branch information
wwmayer committed Jun 10, 2014
1 parent f867733 commit 8923810
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 16 deletions.
14 changes: 6 additions & 8 deletions src/Mod/PartDesign/Gui/TaskChamferParameters.cpp
Expand Up @@ -57,19 +57,18 @@ TaskChamferParameters::TaskChamferParameters(ViewProviderChamfer *ChamferView,QW
ui->setupUi(proxy);
QMetaObject::connectSlotsByName(this);

connect(ui->doubleSpinBox, SIGNAL(valueChanged(double)),
connect(ui->chamferDistance, SIGNAL(valueChanged(double)),
this, SLOT(onLengthChanged(double)));

this->groupLayout()->addWidget(proxy);

PartDesign::Chamfer* pcChamfer = static_cast<PartDesign::Chamfer*>(ChamferView->getObject());
double r = pcChamfer->Size.getValue();

ui->doubleSpinBox->setDecimals(Base::UnitsApi::getDecimals());
ui->doubleSpinBox->setMaximum(INT_MAX);
ui->doubleSpinBox->setValue(r);
ui->doubleSpinBox->selectAll();
QMetaObject::invokeMethod(ui->doubleSpinBox, "setFocus", Qt::QueuedConnection);
ui->chamferDistance->setUnit(Base::Unit::Length);
ui->chamferDistance->setValue(r);
ui->chamferDistance->selectNumber();
QMetaObject::invokeMethod(ui->chamferDistance, "setFocus", Qt::QueuedConnection);
}

void TaskChamferParameters::onLengthChanged(double len)
Expand All @@ -81,10 +80,9 @@ void TaskChamferParameters::onLengthChanged(double len)

double TaskChamferParameters::getLength(void) const
{
return ui->doubleSpinBox->value();
return ui->chamferDistance->getQuantity().getValue();
}


TaskChamferParameters::~TaskChamferParameters()
{
delete ui;
Expand Down
16 changes: 8 additions & 8 deletions src/Mod/PartDesign/Gui/TaskChamferParameters.ui
Expand Up @@ -24,19 +24,19 @@
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="doubleSpinBox">
<property name="minimum">
<double>0.000000000000000</double>
</property>
<property name="maximum">
<double>999999999.000000000000000</double>
</property>
</widget>
<widget class="Gui::InputField" name="chamferDistance"/>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>Gui::InputField</class>
<extends>QLineEdit</extends>
<header>Gui/InputField.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

0 comments on commit 8923810

Please sign in to comment.