diff --git a/src/Gui/InputVector.cpp b/src/Gui/InputVector.cpp index ca267b405adc..a555fb2ce20e 100644 --- a/src/Gui/InputVector.cpp +++ b/src/Gui/InputVector.cpp @@ -28,6 +28,7 @@ #include "InputVector.h" #include "ui_InputVector.h" +#include "QuantitySpinBox.h" #include using namespace Gui; @@ -37,21 +38,21 @@ LocationWidget::LocationWidget (QWidget * parent) { box = new QGridLayout(); - xValue = new QDoubleSpinBox(this); + xValue = new QuantitySpinBox(this); xValue->setMinimum(-2.14748e+09); xValue->setMaximum(2.14748e+09); xLabel = new QLabel(this); box->addWidget(xLabel, 0, 0, 1, 1); box->addWidget(xValue, 0, 1, 1, 1); - yValue = new QDoubleSpinBox(this); + yValue = new QuantitySpinBox(this); yValue->setMinimum(-2.14748e+09); yValue->setMaximum(2.14748e+09); yLabel = new QLabel(this); box->addWidget(yLabel, 1, 0, 1, 1); box->addWidget(yValue, 1, 1, 1, 1); - zValue = new QDoubleSpinBox(this); + zValue = new QuantitySpinBox(this); zValue->setMinimum(-2.14748e+09); zValue->setMaximum(2.14748e+09); zLabel = new QLabel(this); @@ -64,9 +65,9 @@ LocationWidget::LocationWidget (QWidget * parent) box->addWidget(dLabel, 3, 0, 1, 1); box->addWidget(dValue, 3, 1, 1, 1); - xValue->setDecimals(Base::UnitsApi::getDecimals()); - yValue->setDecimals(Base::UnitsApi::getDecimals()); - zValue->setDecimals(Base::UnitsApi::getDecimals()); + xValue->setUnit(Base::Unit::Length); + yValue->setUnit(Base::Unit::Length); + zValue->setUnit(Base::Unit::Length); QGridLayout* gridLayout = new QGridLayout(this); gridLayout->addLayout(box, 0, 0, 1, 2); @@ -122,13 +123,13 @@ void LocationWidget::retranslateUi() dValue->setItemText(dValue->count()-1, QApplication::translate("Gui::LocationDialog", "User defined...")); } -} +} Base::Vector3d LocationWidget::getPosition() const { - return Base::Vector3d(this->xValue->value(), - this->yValue->value(), - this->zValue->value()); + return Base::Vector3d(this->xValue->value().getValue(), + this->yValue->value().getValue(), + this->zValue->value().getValue()); } void LocationWidget::setPosition(const Base::Vector3d& v) diff --git a/src/Gui/InputVector.h b/src/Gui/InputVector.h index 484c2c2dd16c..080f0babb4da 100644 --- a/src/Gui/InputVector.h +++ b/src/Gui/InputVector.h @@ -26,7 +26,7 @@ #include #include #include -#include +#include #include @@ -36,6 +36,7 @@ class QDoubleSpinBox; class QComboBox; namespace Gui { +class QuantitySpinBox; class GuiExport LocationWidget : public QWidget { @@ -65,9 +66,9 @@ private Q_SLOTS: QLabel *yLabel; QLabel *zLabel; QLabel *dLabel; - QDoubleSpinBox *xValue; - QDoubleSpinBox *yValue; - QDoubleSpinBox *zValue; + QuantitySpinBox *xValue; + QuantitySpinBox *yValue; + QuantitySpinBox *zValue; QComboBox *dValue; }; @@ -155,9 +156,9 @@ class LocationInterface : public LocationDialog, public Ui Base::Vector3d getPosition() const { - return Base::Vector3d(this->xPos->value(), - this->yPos->value(), - this->zPos->value()); + return Base::Vector3d(this->xPos->value().getValue(), + this->yPos->value().getValue(), + this->zPos->value().getValue()); } Base::Vector3d getDirection() const @@ -284,9 +285,9 @@ class LocationInterfaceComp : public Ui Base::Vector3d getPosition() const { - return Base::Vector3d(this->xPos->value(), - this->yPos->value(), - this->zPos->value()); + return Base::Vector3d(this->xPos->value().getValue(), + this->yPos->value().getValue(), + this->zPos->value().getValue()); } Base::Vector3d getDirection() const