diff --git a/src/Mod/Fem/Gui/PlaneWidget.ui b/src/Mod/Fem/Gui/PlaneWidget.ui
index 1045a66057..2f8facac68 100644
--- a/src/Mod/Fem/Gui/PlaneWidget.ui
+++ b/src/Mod/Fem/Gui/PlaneWidget.ui
@@ -6,187 +6,141 @@
0
0
- 287
- 84
+ 280
+ 85
Form
-
-
- 2
-
-
- 6
-
-
- 0
-
- -
-
-
- Origin
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- 2
-
-
-
-
-
-
- 0
- 0
-
+
+
-
+
+
-
+
+
+ x
-
-
- 70
- 0
-
-
-
- -999999999.000000000000000
-
-
- 999999999.000000000000000
+
+ Qt::AlignCenter
- -
-
-
-
- 0
- 0
-
+
-
+
+
+ y
-
-
- 70
- 0
-
-
-
- -999999999.000000000000000
-
-
- 999999999.000000000000000
-
-
- 0.000000000000000
+
+ Qt::AlignCenter
- -
-
-
-
- 0
- 0
-
+
-
+
+
+ z
-
-
- 70
- 0
-
-
-
- -999999999.000000000000000
-
-
- 999999999.000000000000000
+
+ Qt::AlignCenter
-
-
- -
-
-
- Normal
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- 2
-
-
-
-
-
-
- 0
- 0
-
+
-
+
+
+ Origin
-
-
- 70
- 0
-
-
-
- -999999999.000000000000000
-
-
- 999999999.000000000000000
+
+ Qt::AlignCenter
- -
-
-
-
- 0
- 0
-
-
-
+
-
+
+
- 70
- 0
+ 95
+ 16777215
-
- -999999999.000000000000000
-
-
- 999999999.000000000000000
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
- -
-
-
-
- 0
- 0
-
-
-
+
-
+
+
- 70
- 0
+ 95
+ 16777215
-
- -999999999.000000000000000
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
- 999999999.000000000000000
+
+
+ -
+
+
+
+ 95
+ 16777215
+
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+ Normal
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 95
+ 16777215
+
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 95
+ 16777215
+
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 95
+ 16777215
+
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -194,6 +148,18 @@
+
+
+ Gui::QuantitySpinBox
+ QWidget
+
+
+
+ Gui::PrefQuantitySpinBox
+ Gui::QuantitySpinBox
+
+
+
diff --git a/src/Mod/Fem/Gui/SphereWidget.ui b/src/Mod/Fem/Gui/SphereWidget.ui
index 1c559ff4dd..1420100454 100644
--- a/src/Mod/Fem/Gui/SphereWidget.ui
+++ b/src/Mod/Fem/Gui/SphereWidget.ui
@@ -6,152 +6,121 @@
0
0
- 346
- 84
+ 280
+ 85
Form
-
-
- 2
-
-
- 6
-
-
- 0
-
- -
-
-
- Radius
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- 2
-
-
-
-
-
-
- 0
- 0
-
+
+
-
+
+
-
+
+
+ x
-
-
- 70
- 0
-
-
-
- false
-
-
- -999999999.000000000000000
-
-
- 999999999.000000000000000
+
+ Qt::AlignCenter
-
-
- -
-
-
- Center
-
-
- Qt::AlignCenter
-
-
-
- -
-
-
- 2
-
-
-
-
-
-
- 0
- 0
-
+
-
+
+
+ y
-
-
- 70
- 0
-
-
-
- false
-
-
- -999999999.000000000000000
-
-
- 999999999.000000000000000
+
+ Qt::AlignCenter
- -
-
-
-
- 0
- 0
-
+
-
+
+
+ z
-
-
- 70
- 0
-
-
-
- false
-
-
- -999999999.000000000000000
-
-
- 999999999.000000000000000
+
+ Qt::AlignCenter
- -
-
-
-
- 0
- 0
-
+
-
+
+
+ Center
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 95
+ 16777215
+
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
+
+
+ 95
+ 16777215
+
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
+
+
+
+ -
+
- 70
+ 0
0
-
- false
+
+
+ 95
+ 16777215
+
-
- -999999999.000000000000000
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
- 999999999.000000000000000
+
+
+ -
+
+
+ Radius
+
+
+ Qt::AlignCenter
+
+
+
+ -
+
+
+
+ 95
+ 16777215
+
+
+
+ Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
@@ -159,6 +128,18 @@
+
+
+ Gui::QuantitySpinBox
+ QWidget
+
+
+
+ Gui::PrefQuantitySpinBox
+ Gui::QuantitySpinBox
+
+
+
diff --git a/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp b/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp
index 271838bebe..25026475ce 100644
--- a/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp
+++ b/src/Mod/Fem/Gui/ViewProviderFemPostFunction.cpp
@@ -48,6 +48,7 @@
#include
#include
+#include
#include
#include
#include
@@ -500,13 +501,20 @@ PlaneWidget::PlaneWidget() {
ui = new Ui_PlaneWidget();
ui->setupUi(this);
+ int UserDecimals = Base::UnitsApi::getDecimals();
+ ui->originX->setDecimals(UserDecimals);
+ ui->originY->setDecimals(UserDecimals);
+ ui->originZ->setDecimals(UserDecimals);
+ ui->normalX->setDecimals(UserDecimals);
+ ui->normalY->setDecimals(UserDecimals);
+ ui->normalZ->setDecimals(UserDecimals);
+
connect(ui->originX, SIGNAL(valueChanged(double)), this, SLOT(originChanged(double)));
connect(ui->originY, SIGNAL(valueChanged(double)), this, SLOT(originChanged(double)));
connect(ui->originZ, SIGNAL(valueChanged(double)), this, SLOT(originChanged(double)));
connect(ui->normalX, SIGNAL(valueChanged(double)), this, SLOT(normalChanged(double)));
connect(ui->normalY, SIGNAL(valueChanged(double)), this, SLOT(normalChanged(double)));
connect(ui->normalZ, SIGNAL(valueChanged(double)), this, SLOT(normalChanged(double)));
-
}
PlaneWidget::~PlaneWidget() {
@@ -520,6 +528,13 @@ void PlaneWidget::applyPythonCode() {
void PlaneWidget::setViewProvider(ViewProviderFemPostFunction* view) {
FemGui::FunctionWidget::setViewProvider(view);
+ const Base::Unit unit = static_cast(getObject())->Origin.getUnit();
+ setBlockObjectUpdates(true);
+ ui->originX->setUnit(unit);
+ ui->originY->setUnit(unit);
+ ui->originZ->setUnit(unit);
+ setBlockObjectUpdates(false);
+ // The normal vector is unitless. It uses nevertheless Gui::PrefQuantitySpinBox to keep dialog uniform.
onChange(static_cast(getObject())->Normal);
onChange(static_cast(getObject())->Origin);
}
@@ -545,7 +560,8 @@ void PlaneWidget::onChange(const App::Property& p) {
void PlaneWidget::normalChanged(double) {
if (!blockObjectUpdates()) {
- Base::Vector3d vec(ui->normalX->value(), ui->normalY->value(), ui->normalZ->value());
+ Base::Vector3d vec(ui->normalX->value().getValue(), ui->normalY->value().getValue(),
+ ui->normalZ->value().getValue());
static_cast(getObject())->Normal.setValue(vec);
}
}
@@ -553,7 +569,8 @@ void PlaneWidget::normalChanged(double) {
void PlaneWidget::originChanged(double) {
if (!blockObjectUpdates()) {
- Base::Vector3d vec(ui->originX->value(), ui->originY->value(), ui->originZ->value());
+ Base::Vector3d vec(ui->originX->value().getValue(), ui->originY->value().getValue(),
+ ui->originZ->value().getValue());
static_cast(getObject())->Origin.setValue(vec);
}
}
@@ -616,7 +633,6 @@ SoTransformManip* ViewProviderFemPostSphereFunction::setupManipulator() {
return manip;
}
-
void ViewProviderFemPostSphereFunction::draggerUpdate(SoDragger* m) {
Fem::FemPostSphereFunction* func = static_cast(getObject());
@@ -658,6 +674,11 @@ SphereWidget::SphereWidget() {
ui = new Ui_SphereWidget();
ui->setupUi(this);
+ int UserDecimals = Base::UnitsApi::getDecimals();
+ ui->centerX->setDecimals(UserDecimals);
+ ui->centerY->setDecimals(UserDecimals);
+ ui->centerZ->setDecimals(UserDecimals);
+
connect(ui->centerX, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double)));
connect(ui->centerY, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double)));
connect(ui->centerZ, SIGNAL(valueChanged(double)), this, SLOT(centerChanged(double)));
@@ -675,6 +696,14 @@ void SphereWidget::applyPythonCode() {
void SphereWidget::setViewProvider(ViewProviderFemPostFunction* view) {
FemGui::FunctionWidget::setViewProvider(view);
+ setBlockObjectUpdates(true);
+ Base::Unit unit = static_cast(getObject())->Center.getUnit();
+ ui->centerX->setUnit(unit);
+ ui->centerY->setUnit(unit);
+ ui->centerZ->setUnit(unit);
+ unit = static_cast(getObject())->Radius.getUnit();
+ ui->radius->setUnit(unit);
+ setBlockObjectUpdates(false);
onChange(static_cast(getObject())->Center);
onChange(static_cast(getObject())->Radius);
}
@@ -698,7 +727,8 @@ void SphereWidget::onChange(const App::Property& p) {
void SphereWidget::centerChanged(double) {
if (!blockObjectUpdates()) {
- Base::Vector3d vec(ui->centerX->value(), ui->centerY->value(), ui->centerZ->value());
+ Base::Vector3d vec(ui->centerX->value().getValue(), ui->centerY->value().getValue(),
+ ui->centerZ->value().getValue());
static_cast(getObject())->Center.setValue(vec);
}
}
@@ -706,7 +736,7 @@ void SphereWidget::centerChanged(double) {
void SphereWidget::radiusChanged(double) {
if (!blockObjectUpdates()) {
- static_cast(getObject())->Radius.setValue(ui->radius->value());
+ static_cast(getObject())->Radius.setValue(ui->radius->value().getValue());
}
}