[TD]allow showing units on individual dimensions

This commit is contained in:
wandererfan
2025-01-24 13:04:00 -05:00
parent 06143dcb15
commit 2bc9f2ea1f
7 changed files with 29 additions and 26 deletions

View File

@@ -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

View File

@@ -94,6 +94,8 @@ public:
App::PropertyVectorList BoxCorners;
App::PropertyBool UseActualArea;
App::PropertyBool ShowUnits;
enum RefType
{
invalidRef,

View File

@@ -682,3 +682,11 @@ bool Preferences::useLegacySvgScaling()
{
return getPreferenceGroup("General")->GetBool("LegacySvgScaling", false);
}
bool Preferences::showUnits()
{
return Preferences::getPreferenceGroup("Dimensions")->GetBool("ShowUnits", false);
}

View File

@@ -159,6 +159,8 @@ public:
static bool useLegacySvgScaling();
static bool showUnits();
};

View File

@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>440</width>
<height>508</height>
<width>495</width>
<height>692</height>
</rect>
</property>
<property name="sizePolicy">
@@ -35,7 +35,7 @@
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="8" column="2">
<widget class="Gui::PrefUnitSpinBox" name="plsb_ArrowSize">
<widget class="Gui::PrefUnitSpinBox" name="plsb_ArrowSize" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -45,7 +45,7 @@
<property name="toolTip">
<string>Arrowhead size</string>
</property>
<property name="value">
<property name="value" stdset="0">
<double>5.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
@@ -156,6 +156,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="toolTip">
<string>Append unit to dimension values</string>
</property>
@@ -183,7 +188,7 @@
</widget>
</item>
<item row="4" column="2">
<widget class="Gui::PrefUnitSpinBox" name="plsb_FontSize">
<widget class="Gui::PrefUnitSpinBox" name="plsb_FontSize" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -193,7 +198,7 @@
<property name="toolTip">
<string>Dimension text font size</string>
</property>
<property name="value">
<property name="value" stdset="0">
<double>4.000000000000000</double>
</property>
<property name="prefEntry" stdset="0">
@@ -544,7 +549,7 @@ Multiplier of 'Font Size'</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item row="0" column="1">
<widget class="QComboBox" name="dimensioningMode">
<property name="toolTip">
<string>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
</property>
</widget>
</item>
<item row="1" column="1">
<item row="1" column="1">
<widget class="QComboBox" name="radiusDiameterMode">
<property name="toolTip">
<string>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
<header>Gui/PrefWidgets.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="Resources/TechDraw.qrc"/>
</resources>
<resources/>
<connections>
<connection>
<sender>cbGlobalDecimals</sender>

View File

@@ -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()
{

View File

@@ -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();