From cc0e1a8f3a2b615120a3c454ef23d967eb9b3e52 Mon Sep 17 00:00:00 2001 From: donovaly Date: Sun, 3 Nov 2019 23:54:12 +0100 Subject: [PATCH] DrawViewAnnotation: add transformation procedure for changed properties --- src/Mod/TechDraw/App/DrawViewAnnotation.cpp | 18 ++++++++++++++++++ src/Mod/TechDraw/App/DrawViewAnnotation.h | 1 + 2 files changed, 19 insertions(+) diff --git a/src/Mod/TechDraw/App/DrawViewAnnotation.cpp b/src/Mod/TechDraw/App/DrawViewAnnotation.cpp index e5c80eef33..e166b71f8e 100644 --- a/src/Mod/TechDraw/App/DrawViewAnnotation.cpp +++ b/src/Mod/TechDraw/App/DrawViewAnnotation.cpp @@ -97,6 +97,24 @@ void DrawViewAnnotation::onChanged(const App::Property* prop) TechDraw::DrawView::onChanged(prop); } +void DrawViewAnnotation::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop) +// transforms properties that had been changed +{ + // property LineSpace had the App::PropertyInteger and was changed to App::PropertyPercent + if (prop == &LineSpace && strcmp(TypeName, "App::PropertyInteger") == 0) { + App::PropertyInteger LineSpaceProperty; + // restore the PropertyInteger to be able to set its value + LineSpaceProperty.Restore(reader); + LineSpace.setValue(LineSpaceProperty.getValue()); + } + // property MaxWidth had the App::PropertyFloat and was changed to App::PropertyLength + else if (prop == &MaxWidth && strcmp(TypeName, "App::PropertyFloat") == 0) { + App::PropertyFloat MaxWidthProperty; + MaxWidthProperty.Restore(reader); + MaxWidth.setValue(MaxWidthProperty.getValue()); + } +} + QRectF DrawViewAnnotation::getRect() const { QRectF result; diff --git a/src/Mod/TechDraw/App/DrawViewAnnotation.h b/src/Mod/TechDraw/App/DrawViewAnnotation.h index e3854e7509..102084a58e 100644 --- a/src/Mod/TechDraw/App/DrawViewAnnotation.h +++ b/src/Mod/TechDraw/App/DrawViewAnnotation.h @@ -70,6 +70,7 @@ public: protected: virtual void onChanged(const App::Property* prop); + void handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property * prop); private: static const char* TextStyleEnums[];