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/qqmlvmemetaobject_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/qqmlvmemetaobject_p.h')
-rw-r--r-- | src/qml/qml/qqmlvmemetaobject_p.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlvmemetaobject_p.h b/src/qml/qml/qqmlvmemetaobject_p.h index 5aa141d026..4a81fc50d2 100644 --- a/src/qml/qml/qqmlvmemetaobject_p.h +++ b/src/qml/qml/qqmlvmemetaobject_p.h @@ -72,6 +72,7 @@ #include <private/qv4object_p.h> #include <private/qv4value_p.h> +#include <private/qqmlpropertyvalueinterceptor_p.h> QT_BEGIN_NAMESPACE @@ -105,6 +106,15 @@ public: // Used by auto-tests for inspection QQmlPropertyCache *propertyCache() const { return cache; } + bool intercepts(int coreIndex) const + { + for (auto it = interceptors; it; it = it->m_next) { + if (it->m_coreIndex == coreIndex) + return true; + } + return false; + } + protected: int metaCall(QObject *o, QMetaObject::Call c, int id, void **a) Q_DECL_OVERRIDE; bool intercept(QMetaObject::Call c, int id, void **a); |