diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2020-03-23 21:32:38 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2020-03-30 14:18:18 +0200 |
commit | dff7689a016d63fbaf1abc6f00a768dbfb8ec095 (patch) | |
tree | 6f0b67ce5d6dec279c0bbf62f014955cd0f25e32 /src/qml/qml/qqmlpropertydata_p.h | |
parent | 9f2c5aa2efd24507f4508889911873bc1c9d301e (diff) |
Add support for binding directly to QProperty instances
Avoid going through externally managed bindings and instead allocate a
more lightweight property binding. It's basically a
QQmlJavaScriptExpression and one pointer plus the overhead of
QPropertyBindingPrivate.
Change-Id: I1530330926d351b61f2b3bbad39301c628a8bef1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlpropertydata_p.h')
-rw-r--r-- | src/qml/qml/qqmlpropertydata_p.h | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/qml/qml/qqmlpropertydata_p.h b/src/qml/qml/qqmlpropertydata_p.h index 9fa272bcdf..697c995706 100644 --- a/src/qml/qml/qqmlpropertydata_p.h +++ b/src/qml/qml/qqmlpropertydata_p.h @@ -97,7 +97,7 @@ public: // b when type equals FunctionType. For that reason, the semantic meaning of the bit is // overloaded, and the accessor functions are used to get the correct value // - // Moreover, isSignalHandler, isOverload and isCloned and isConstructor make only sense + // Moreover, isSignalHandler, isOverload and isCloned make only sense // for functions, too (and could at a later point be reused for flags that only make sense // for non-functions) // @@ -111,7 +111,7 @@ public: unsigned isSignalHandler : 1; // Function is a signal handler unsigned isOverload : 1; // Function is an overload of another function unsigned isRequiredORisCloned : 1; // Has REQUIRED flag OR The function was marked as cloned - unsigned isConstructor : 1; // The function was marked is a constructor + unsigned isConstructorORisQProperty : 1; // The function was marked is a constructor OR property is backed by QProperty<T> unsigned isDirect : 1; // Exists on a C++ QMetaObject unsigned isOverridden : 1; // Is overridden by a extension property public: @@ -156,6 +156,10 @@ public: isOverridden = b; } + void setIsQProperty(bool b) { + isConstructorORisQProperty = b; + } + void setIsDirect(bool b) { isDirect = b; } @@ -204,7 +208,7 @@ public: void setIsConstructor(bool b) { Q_ASSERT(type == FunctionType); - isConstructor = b; + isConstructorORisQProperty = b; } }; @@ -249,7 +253,8 @@ public: bool isOverload() const { return m_flags.isOverload; } void setOverload(bool onoff) { m_flags.isOverload = onoff; } bool isCloned() const { return isFunction() && m_flags.isRequiredORisCloned; } - bool isConstructor() const { return m_flags.isConstructor; } + bool isConstructor() const { return m_flags.isConstructorORisQProperty; } + bool isQProperty() const { return m_flags.isConstructorORisQProperty; } bool hasOverride() const { return overrideIndex() >= 0; } bool hasRevision() const { return revision() != QTypeRevision::zero(); } @@ -441,7 +446,7 @@ QQmlPropertyData::Flags::Flags() , isSignalHandler(false) , isOverload(false) , isRequiredORisCloned(false) - , isConstructor(false) + , isConstructorORisQProperty(false) , isOverridden(false) , type(OtherType) , notFullyResolved(false) @@ -459,7 +464,7 @@ bool QQmlPropertyData::Flags::operator==(const QQmlPropertyData::Flags &other) c isSignalHandler == other.isSignalHandler && isRequiredORisCloned == other.isRequiredORisCloned && type == other.type && - isConstructor == other.isConstructor && + isConstructorORisQProperty == other.isConstructorORisQProperty && notFullyResolved == other.notFullyResolved && overrideIndexIsProperty == other.overrideIndexIsProperty; } |