DrawViewBalloon: add units there as well

since OriginX/Y depend on DrawView base X/Y

- also adapt the balloon test accordingly
This commit is contained in:
donovaly
2019-11-30 19:18:48 +01:00
committed by WandererFan
parent a89e55e1e7
commit f4c7c9bc25
3 changed files with 38 additions and 14 deletions

View File

@@ -128,6 +128,27 @@ void DrawViewBalloon::onDocumentRestored()
}
void DrawViewBalloon::handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property *prop)
// transforms properties that had been changed
{
// also check for changed properties of the base class
DrawView::handleChangedPropertyType(reader, TypeName, prop);
// property OriginX had the App::PropertyFloat and was changed to App::PropertyLength
if (prop == &OriginX && strcmp(TypeName, "App::PropertyFloat") == 0) {
App::PropertyInteger OriginXProperty;
// restore the PropertyInteger to be able to set its value
OriginXProperty.Restore(reader);
OriginX.setValue(OriginXProperty.getValue());
}
// property OriginY had the App::PropertyFloat and was changed to App::PropertyLength
else if (prop == &OriginY && strcmp(TypeName, "App::PropertyFloat") == 0) {
App::PropertyFloat OriginYProperty;
OriginYProperty.Restore(reader);
OriginY.setValue(OriginYProperty.getValue());
}
}
short DrawViewBalloon::mustExecute() const
{

View File

@@ -27,6 +27,7 @@
# include <App/DocumentObject.h>
# include <App/FeaturePython.h>
# include <App/PropertyLinks.h>
# include <App/PropertyUnits.h>
#include "DrawView.h"
@@ -53,8 +54,8 @@ public:
App::PropertyEnumeration EndType;
App::PropertyEnumeration Symbol;
App::PropertyFloat SymbolScale;
App::PropertyFloat OriginX;
App::PropertyFloat OriginY;
App::PropertyLength OriginX;
App::PropertyLength OriginY;
App::PropertyBool OriginIsSet;
App::PropertyFloat TextWrapLen;
@@ -79,6 +80,7 @@ public:
protected:
void onChanged(const App::Property* prop);
virtual void onDocumentRestored();
virtual void handleChangedPropertyType(Base::XMLReader &reader, const char *TypeName, App::Property * prop);
private:
};