diff --git a/src/Mod/TechDraw/App/DrawViewDimension.cpp b/src/Mod/TechDraw/App/DrawViewDimension.cpp index ce421aab3b..3e68441592 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.cpp +++ b/src/Mod/TechDraw/App/DrawViewDimension.cpp @@ -231,6 +231,8 @@ DrawViewDimension::DrawViewDimension() "If true, area dimensions return the area of the face minus the areas of any enclosed faces. \ If false, the area of the face's outer boundary is returned."); + ADD_PROPERTY_TYPE(ShowUnits, (Preferences::showUnits()), "Format", App::Prop_None, + "Show or hide the units."); measurement = new Measure::Measurement(); // TODO: should have better initial datumLabel position than (0, 0) in the DVP?? something // closer to the object being measured? @@ -2076,7 +2078,7 @@ bool DrawViewDimension::hasOverUnderTolerance() const bool DrawViewDimension::showUnits() const { - return Preferences::getPreferenceGroup("Dimensions")->GetBool("ShowUnits", false); + return ShowUnits.getValue(); } bool DrawViewDimension::useDecimals() const diff --git a/src/Mod/TechDraw/App/DrawViewDimension.h b/src/Mod/TechDraw/App/DrawViewDimension.h index c45ab4f0d1..5ee5380e34 100644 --- a/src/Mod/TechDraw/App/DrawViewDimension.h +++ b/src/Mod/TechDraw/App/DrawViewDimension.h @@ -94,6 +94,8 @@ public: App::PropertyVectorList BoxCorners; App::PropertyBool UseActualArea; + App::PropertyBool ShowUnits; + enum RefType { invalidRef, diff --git a/src/Mod/TechDraw/App/Preferences.cpp b/src/Mod/TechDraw/App/Preferences.cpp index 6577a700fe..ef2c5b625e 100644 --- a/src/Mod/TechDraw/App/Preferences.cpp +++ b/src/Mod/TechDraw/App/Preferences.cpp @@ -682,3 +682,11 @@ bool Preferences::useLegacySvgScaling() { return getPreferenceGroup("General")->GetBool("LegacySvgScaling", false); } + + +bool Preferences::showUnits() +{ + return Preferences::getPreferenceGroup("Dimensions")->GetBool("ShowUnits", false); +} + + diff --git a/src/Mod/TechDraw/App/Preferences.h b/src/Mod/TechDraw/App/Preferences.h index 2a62f585bc..33243531ea 100644 --- a/src/Mod/TechDraw/App/Preferences.h +++ b/src/Mod/TechDraw/App/Preferences.h @@ -159,6 +159,8 @@ public: static bool useLegacySvgScaling(); + static bool showUnits(); + }; diff --git a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui index d5c885c36c..ace78652d9 100644 --- a/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui +++ b/src/Mod/TechDraw/Gui/DlgPrefsTechDrawDimensions.ui @@ -6,8 +6,8 @@ 0 0 - 440 - 508 + 495 + 692 @@ -35,7 +35,7 @@ - + 0 @@ -45,7 +45,7 @@ Arrowhead size - + 5.000000000000000 @@ -156,6 +156,11 @@ 0 + + + true + + Append unit to dimension values @@ -183,7 +188,7 @@ - + 0 @@ -193,7 +198,7 @@ Dimension text font size - + 4.000000000000000 @@ -544,7 +549,7 @@ Multiplier of 'Font Size' - + Select the type of dimensioning tools for your toolbar: @@ -562,7 +567,7 @@ This setting is only for the toolbar. Whichever you choose, all tools are always - + While using the Dimension tool you may choose how to handle circles and arcs: @@ -627,9 +632,7 @@ This setting is only for the toolbar. Whichever you choose, all tools are always
Gui/PrefWidgets.h
- - - + cbGlobalDecimals diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp index f426d0969e..d636e74ad5 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.cpp +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.cpp @@ -548,19 +548,6 @@ void QGIDatumLabel::setToleranceString() updateFrameRect(); } -void QGIDatumLabel::setUnitString(QString text) -{ - prepareGeometryChange(); - if (text.isEmpty()) { - m_unitText->hide(); - } - else { - m_unitText->setPlainText(text); - m_unitText->show(); - } - updateFrameRect(); -} - int QGIDatumLabel::getPrecision() { diff --git a/src/Mod/TechDraw/Gui/QGIViewDimension.h b/src/Mod/TechDraw/Gui/QGIViewDimension.h index 7dcb13660a..d14733e8a9 100644 --- a/src/Mod/TechDraw/Gui/QGIViewDimension.h +++ b/src/Mod/TechDraw/Gui/QGIViewDimension.h @@ -83,7 +83,6 @@ public: QFont getFont() const { return m_dimText->font(); } void setDimString(QString text); void setDimString(QString text, qreal maxWidth); - void setUnitString(QString text); void setToleranceString(); void setPrettySel(); void setPrettyPre();