[TD] some fixes

- the setting "Standard and Style" only affects new dimensions, thus it must be italic

- fix bug that the Property 'LockPosition' appears for dimensions -> this is an option for views and thus must be hidden for dimensions

- since tolerances are in the vast majority fractions of a millimeter/inch, set its stepsize to 0.1
(I hope I did it right in handleChangedPropertyType.)

- fix inconsistent newlines in TaskBalloon.h

- improve wording for a heading
This commit is contained in:
donovaly
2021-01-09 03:21:51 +01:00
parent 1851ddd933
commit e8d76d49bf
5 changed files with 41 additions and 16 deletions

View File

@@ -116,10 +116,15 @@ DrawViewDimension::DrawViewDimension(void)
ADD_PROPERTY(MeasureType, ((long)1)); //Projected (or True) measurement
ADD_PROPERTY_TYPE(TheoreticalExact,(false), "", App::Prop_Output, "Set for theoretical exact (basic) dimension");
ADD_PROPERTY_TYPE(EqualTolerance, (true), "", App::Prop_Output, "If over- and undertolerance are equal");
// constraint to set the step size to 0.1
static const App::PropertyQuantityConstraint::Constraints ToleranceConstraint = { -DBL_MAX, DBL_MAX, 0.1 };
ADD_PROPERTY_TYPE(OverTolerance, (0.0), "", App::Prop_Output, "Overtolerance value\nIf 'Equal Tolerance' is true this is also the value for 'Under Tolerance'");
OverTolerance.setUnit(Base::Unit::Length);
OverTolerance.setConstraints(&ToleranceConstraint);
ADD_PROPERTY_TYPE(UnderTolerance, (0.0), "", App::Prop_Output, "Undertolerance value\nIf 'Equal Tolerance' it will be replaced by negative value of 'Over Tolerance'");
UnderTolerance.setUnit(Base::Unit::Length);
UnderTolerance.setConstraints(&ToleranceConstraint);
ADD_PROPERTY_TYPE(Inverted, (false), "", App::Prop_Output, "The dimensional value is displayed inverted");
//hide the DrawView properties that don't apply to Dimensions
@@ -130,6 +135,7 @@ DrawViewDimension::DrawViewDimension(void)
Rotation.setStatus(App::Property::ReadOnly, true);
Rotation.setStatus(App::Property::Hidden, true);
Caption.setStatus(App::Property::Hidden, true);
LockPosition.setStatus(App::Property::Hidden, true);
// by default EqualTolerance is true, thus make UnderTolerance read-only
UnderTolerance.setStatus(App::Property::ReadOnly, true);
@@ -266,6 +272,20 @@ void DrawViewDimension::handleChangedPropertyType(Base::XMLReader &reader, const
else {
TechDraw::DrawView::handleChangedPropertyType(reader, TypeName, prop);
}
// Over/Undertolerance were further changed from App::PropertyQuantity to App::PropertyQuantityConstraint
if ((prop == &OverTolerance) && (strcmp(TypeName, "App::PropertyQuantity") == 0)) {
App::PropertyQuantity OverToleranceProperty;
// restore the PropertyQuantity to be able to set its value
OverToleranceProperty.Restore(reader);
OverTolerance.setValue(OverToleranceProperty.getValue());
}
else if ((prop == &UnderTolerance) && (strcmp(TypeName, "App::PropertyQuantity") == 0)) {
App::PropertyQuantity UnderToleranceProperty;
// restore the PropertyQuantity to be able to set its value
UnderToleranceProperty.Restore(reader);
UnderTolerance.setValue(UnderToleranceProperty.getValue());
}
}

View File

@@ -94,20 +94,20 @@ public:
DrawViewDimension();
virtual ~DrawViewDimension();
App::PropertyEnumeration MeasureType; //True/Projected
App::PropertyLinkSubList References2D; //Points to Projection SubFeatures
App::PropertyLinkSubList References3D; //Points to 3D Geometry SubFeatures
App::PropertyEnumeration Type; //DistanceX,DistanceY,Diameter, etc
App::PropertyEnumeration MeasureType; //True/Projected
App::PropertyLinkSubList References2D; //Points to Projection SubFeatures
App::PropertyLinkSubList References3D; //Points to 3D Geometry SubFeatures
App::PropertyEnumeration Type; //DistanceX, DistanceY, Diameter, etc.
App::PropertyBool TheoreticalExact;
App::PropertyBool Inverted;
App::PropertyString FormatSpec;
App::PropertyString FormatSpecTolerance;
App::PropertyBool Arbitrary;
App::PropertyBool ArbitraryTolerances;
App::PropertyBool EqualTolerance;
App::PropertyQuantity OverTolerance;
App::PropertyQuantity UnderTolerance;
App::PropertyBool TheoreticalExact;
App::PropertyBool Inverted;
App::PropertyString FormatSpec;
App::PropertyString FormatSpecTolerance;
App::PropertyBool Arbitrary;
App::PropertyBool ArbitraryTolerances;
App::PropertyBool EqualTolerance;
App::PropertyQuantityConstraint OverTolerance;
App::PropertyQuantityConstraint UnderTolerance;
enum RefType{
invalidRef,

View File

@@ -111,6 +111,11 @@
<height>0</height>
</size>
</property>
<property name="font">
<font>
<italic>true</italic>
</font>
</property>
<property name="text">
<string>Standard and Style</string>
</property>

View File

@@ -58,8 +58,8 @@ private Q_SLOTS:
void onFontsizeChanged();
void onBubbleShapeChanged();
void onShapeScaleChanged();
void onEndSymbolChanged();
void onEndSymbolScaleChanged();
void onEndSymbolChanged();
void onEndSymbolScaleChanged();
void onLineVisibleChanged();
void onLineWidthChanged();
void onKinkLengthChanged();

View File

@@ -65,7 +65,7 @@ ViewProviderDimension::ViewProviderDimension()
{
sPixmap = "TechDraw_Dimension";
static const char *group = "Dim Format";
static const char *group = "Dimension Format";
ADD_PROPERTY_TYPE(Font, (Preferences::labelFont().c_str()),
group, App::Prop_None, "The name of the font to use");