diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2016-04-06 15:16:35 +0200 |
---|---|---|
committer | Robin Burchell <robin.burchell@viroteck.net> | 2016-07-08 12:12:29 +0000 |
commit | 81867dfbf9c16d4300727a08eed9b5c6c979e0ba (patch) | |
tree | 0761b5d426e79bc5f0ff946af3ea0224b16de7ed /src/qml/qml/qqmlabstractbinding_p.h | |
parent | c6d9702bb8694062416fe9ca9789157aaab4cdea (diff) |
QML: Introduce write accessors to QQmlAccessors
Same idea as the read accessors, but with a slight difference: the
property setters do emit signals, so we can't do a direct property write
and have to call the setter. However, it does circumvent the meta-calls.
There is one gotcha: if a property is intercepted (e.g. by a Behavior),
we still have to do the meta-call in order to dispatch the write to the
interceptor.
According to valgrind, this saves 138 instructions on x86 for every
"accessible" property write.
Change-Id: I07dbac95613415559ffa1691734a5af7c84721fc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlabstractbinding_p.h')
-rw-r--r-- | src/qml/qml/qqmlabstractbinding_p.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlabstractbinding_p.h b/src/qml/qml/qqmlabstractbinding_p.h index 45221a4bcd..d25c0c6288 100644 --- a/src/qml/qml/qqmlabstractbinding_p.h +++ b/src/qml/qml/qqmlabstractbinding_p.h @@ -91,6 +91,8 @@ public: inline QQmlAbstractBinding *nextBinding() const; + inline bool canUseAccessor() const + { return m_nextBinding.flag2(); } struct RefCount { RefCount() : refCount(0) {} @@ -112,8 +114,15 @@ protected: inline void setNextBinding(QQmlAbstractBinding *); int m_targetIndex; + + // Pointer is the target object to which the binding binds + // flag1 is the updating flag + // flag2 is the enabled flag QFlagPointer<QObject> m_target; + // Pointer to the next binding in the linked list of bindings. + // flag1 is used for addedToObject + // flag2 indicates if an accessor is can be used (i.e. there is no interceptor on the target) QFlagPointer<QQmlAbstractBinding> m_nextBinding; }; |