diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-04-15 10:24:39 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-26 16:33:56 +0000 |
commit | 01c0c0963794f4dd8c3601e8340cc3dc4dec41bd (patch) | |
tree | 91dc7d0bc38d8f03ddf6a2aff97754c1e9183f33 /src/qml/qml/qqmlbinding.cpp | |
parent | f65f0d4e1da39a5f5fa92e0b8d9ba4ad346d78ef (diff) |
Get rid of QQmlBinding::retargetBinding()
Instead call setTarget directly and properly resolve the required
QQmlPropertyData. Saves some memory for bindings to value types.
Change-Id: I542b456685955add7d395764ff85cb3098b3f208
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/qml/qqmlbinding.cpp')
-rw-r--r-- | src/qml/qml/qqmlbinding.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index e021858509..33fea6bb54 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -183,7 +183,7 @@ void QQmlBinding::update(QQmlPropertyPrivate::WriteFlags flags) QQmlBinding *t = this; int status = -1; void *a[] = { &t, 0, &status, &flags }; - QMetaObject::metacall(*m_coreObject, QMetaObject::WriteProperty, idx, a); + QMetaObject::metacall(m_coreObject, QMetaObject::WriteProperty, idx, a); } else { ep->referenceScarceResources(); @@ -194,7 +194,7 @@ void QQmlBinding::update(QQmlPropertyPrivate::WriteFlags flags) bool needsErrorLocationData = false; if (!watcher.wasDeleted() && !hasError()) - needsErrorLocationData = !QQmlPropertyPrivate::writeBinding(*m_coreObject, m_core, context(), + needsErrorLocationData = !QQmlPropertyPrivate::writeBinding(m_coreObject, m_core, context(), this, result, isUndefined, flags); if (!watcher.wasDeleted()) { @@ -279,20 +279,12 @@ QString QQmlBinding::expression() const QObject *QQmlBinding::targetObject() const { - if (m_coreObject.hasValue()) return m_coreObject.constValue()->target; - else return *m_coreObject; + return m_coreObject; } int QQmlBinding::targetPropertyIndex() const { - if (m_coreObject.hasValue()) return m_coreObject.constValue()->targetProperty; - else return m_core.encodedIndex(); -} - -void QQmlBinding::retargetBinding(QObject *t, int i) -{ - m_coreObject.value().target = t; - m_coreObject.value().targetProperty = i; + return m_core.encodedIndex(); } void QQmlBinding::setTarget(const QQmlProperty &prop) |