+ use quantity box in offset dialog

This commit is contained in:
wmayer 2016-02-27 19:43:48 +01:00
parent da9656dd7a
commit 206e183f52
2 changed files with 15 additions and 3 deletions

View File

@ -73,7 +73,7 @@ OffsetWidget::OffsetWidget(Part::Offset* offset, QWidget* parent)
d->offset = offset; d->offset = offset;
d->ui.setupUi(this); d->ui.setupUi(this);
d->ui.spinOffset->setDecimals(Base::UnitsApi::getDecimals()); d->ui.spinOffset->setUnit(Base::Unit::Length);
d->ui.spinOffset->setRange(-INT_MAX, INT_MAX); d->ui.spinOffset->setRange(-INT_MAX, INT_MAX);
d->ui.spinOffset->setSingleStep(0.1); d->ui.spinOffset->setSingleStep(0.1);
d->ui.spinOffset->setValue(d->offset->Value.getValue()); d->ui.spinOffset->setValue(d->offset->Value.getValue());
@ -144,8 +144,9 @@ bool OffsetWidget::accept()
std::string name = d->offset->getNameInDocument(); std::string name = d->offset->getNameInDocument();
try { try {
double offsetValue = d->ui.spinOffset->value().getValue();
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Value = %f", Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Value = %f",
name.c_str(),d->ui.spinOffset->value()); name.c_str(),offsetValue);
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Mode = %i", Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Mode = %i",
name.c_str(),d->ui.modeType->currentIndex()); name.c_str(),d->ui.modeType->currentIndex());
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Join = %i", Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Join = %i",

View File

@ -22,7 +22,11 @@
</widget> </widget>
</item> </item>
<item row="0" column="2"> <item row="0" column="2">
<widget class="QDoubleSpinBox" name="spinOffset"/> <widget class="Gui::QuantitySpinBox" name="spinOffset">
<property name="unit" stdset="0">
<string notr="true">mm</string>
</property>
</widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
@ -143,6 +147,13 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>Gui::QuantitySpinBox</class>
<extends>QWidget</extends>
<header>Gui/QuantitySpinBox.h</header>
</customwidget>
</customwidgets>
<tabstops> <tabstops>
<tabstop>spinOffset</tabstop> <tabstop>spinOffset</tabstop>
<tabstop>modeType</tabstop> <tabstop>modeType</tabstop>