Skip to content

Commit

Permalink
+ use quantity boxes in location widget
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Feb 28, 2016
1 parent d9e47e5 commit dd3d30a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
21 changes: 11 additions & 10 deletions src/Gui/InputVector.cpp
Expand Up @@ -28,6 +28,7 @@

#include "InputVector.h"
#include "ui_InputVector.h"
#include "QuantitySpinBox.h"
#include <Base/UnitsApi.h>

using namespace Gui;
Expand All @@ -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);
Expand All @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
21 changes: 11 additions & 10 deletions src/Gui/InputVector.h
Expand Up @@ -26,7 +26,7 @@
#include <cfloat>
#include <QDialog>
#include <QMessageBox>
#include <QApplication>
#include <QApplication>

#include <Gui/propertyeditor/PropertyItem.h>

Expand All @@ -36,6 +36,7 @@ class QDoubleSpinBox;
class QComboBox;

namespace Gui {
class QuantitySpinBox;

class GuiExport LocationWidget : public QWidget
{
Expand Down Expand Up @@ -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;
};

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dd3d30a

Please sign in to comment.