From 413a822a079fb4495d719d3bcd17cb7c5c9c058b Mon Sep 17 00:00:00 2001 From: "Zheng, Lei" Date: Wed, 23 Oct 2019 07:22:33 +0800 Subject: [PATCH] App: add signalChanged to Property For more efficient tracking of single property changes --- src/App/Property.cpp | 8 +++++++- src/App/Property.h | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/App/Property.cpp b/src/App/Property.cpp index 8f2142fd52..d4571eadd6 100644 --- a/src/App/Property.cpp +++ b/src/App/Property.cpp @@ -32,6 +32,7 @@ #include "ObjectIdentifier.h" #include "PropertyContainer.h" #include +#include #include "Application.h" #include "DocumentObject.h" @@ -212,8 +213,13 @@ void Property::setReadOnly(bool readOnly) void Property::hasSetValue(void) { PropertyCleaner guard(this); - if (father) + if (father) { father->onChanged(this); + if(!testStatus(Busy)) { + Base::BitsetLocker guard(StatusBits,Busy); + signalChanged(*this); + } + } StatusBits.set(Touched); } diff --git a/src/App/Property.h b/src/App/Property.h index 7a1cc64944..9a33b6dad8 100644 --- a/src/App/Property.h +++ b/src/App/Property.h @@ -31,6 +31,7 @@ #include #include #include +#include namespace Py { class Object; @@ -75,6 +76,7 @@ public: // relevant for the container using it EvalOnRestore = 14, // In case of expression binding, evaluate the // expression on restore and touch the object on value change. + Busy = 15, // internal use to avoid recursive signaling // The following bits are corresponding to PropertyType set when the // property added. These types are meant to be static, and cannot be @@ -269,6 +271,9 @@ private: private: PropertyContainer *father; const char *myName; + +public: + boost::signals2::signal signalChanged; };