diff options
author | Lars Knoll <lars.knoll@theqtcompany.com> | 2015-04-15 14:26:50 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@theqtcompany.com> | 2015-04-27 05:20:12 +0000 |
commit | 3bc239a0f16fb93f84def55a5980ef8561e7a7b4 (patch) | |
tree | 790fd34ca8358d4e990ce7e263ceed6fcce03e26 /src/qml/debugger/qqmlenginedebugservice.cpp | |
parent | 629aa559b503aa1b18be35ceff1e20d1817042a3 (diff) |
Simplify binding setup code further
Reduce the number of setBinding/removeBinding overloads and
simplify their internal handling.
Change-Id: I87174a3b2dc0ecb8380e8fc28f8969fbf475c728
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
Diffstat (limited to 'src/qml/debugger/qqmlenginedebugservice.cpp')
-rw-r--r-- | src/qml/debugger/qqmlenginedebugservice.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/src/qml/debugger/qqmlenginedebugservice.cpp b/src/qml/debugger/qqmlenginedebugservice.cpp index 7067a78437..a7ef450606 100644 --- a/src/qml/debugger/qqmlenginedebugservice.cpp +++ b/src/qml/debugger/qqmlenginedebugservice.cpp @@ -646,9 +646,7 @@ bool QQmlEngineDebugService::setBinding(int objectId, } else if (property.isProperty()) { QQmlBinding *binding = new QQmlBinding(expression.toString(), object, QQmlContextData::get(context), filename, line, column); binding->setTarget(property); - QQmlAbstractBinding *oldBinding = QQmlPropertyPrivate::setBinding(property, binding); - if (oldBinding) - oldBinding->destroy(); + QQmlPropertyPrivate::setBinding(binding); binding->update(); } else { ok = false; @@ -679,12 +677,7 @@ bool QQmlEngineDebugService::resetBinding(int objectId, const QString &propertyN if (object->property(parentProperty.toLatin1()).isValid()) { QQmlProperty property(object, propertyName); - QQmlAbstractBinding *oldBinding = QQmlPropertyPrivate::binding(property); - if (oldBinding) { - QQmlAbstractBinding *oldBinding = QQmlPropertyPrivate::removeBinding(property); - if (oldBinding) - oldBinding->destroy(); - } + QQmlPropertyPrivate::removeBinding(property, QQmlPropertyPrivate::DestroyOldBinding); if (property.isResettable()) { // Note: this will reset the property in any case, without regard to states // Right now almost no QQuickItem has reset methods for its properties (with the |