diff options
| author | Lars Knoll <lars.knoll@qt.io> | 2016-11-29 14:58:48 +0100 |
|---|---|---|
| committer | Lars Knoll <lars.knoll@qt.io> | 2016-12-06 13:01:30 +0000 |
| commit | e31e72925f857be56c77b494c0fa10e55de72cfc (patch) | |
| tree | a3486e60e526d4cbe80ca9aafe0bd54472f37e08 /src | |
| parent | df398d105b4e0c5ecc4f62c9895f11b949d3d8e4 (diff) | |
Cleanup and reduce the number of overloads for QQmlBinding::create()
Change-Id: Ibcd277bc434638e5c6e8e9ccea634aa25cde1643
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src')
| -rw-r--r-- | src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp | 2 | ||||
| -rw-r--r-- | src/qml/qml/qqmlbinding.cpp | 29 | ||||
| -rw-r--r-- | src/qml/qml/qqmlbinding_p.h | 4 | ||||
| -rw-r--r-- | src/quick/designer/qquickdesignercustomobjectdata.cpp | 2 | ||||
| -rw-r--r-- | src/quick/qtquick2.cpp | 3 | ||||
| -rw-r--r-- | src/quick/util/qquickpropertychanges.cpp | 8 |
6 files changed, 10 insertions, 38 deletions
diff --git a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp index f72b8a51f9..2b8dcc19ee 100644 --- a/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp +++ b/src/plugins/qmltooling/qmldbg_debugger/qqmlenginedebugservice.cpp @@ -660,7 +660,7 @@ bool QQmlEngineDebugServiceImpl::setBinding(int objectId, filename, line, column); QQmlPropertyPrivate::takeSignalExpression(property, qmlExpression); } else if (property.isProperty()) { - QQmlBinding *binding = QQmlBinding::create(&QQmlPropertyPrivate::get(property)->core, expression.toString(), object, QQmlContextData::get(context), filename, line, column); + QQmlBinding *binding = QQmlBinding::create(&QQmlPropertyPrivate::get(property)->core, expression.toString(), object, QQmlContextData::get(context), filename, line); binding->setTarget(property); QQmlPropertyPrivate::setBinding(binding); binding->update(); diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index c150b1ee29..57fbe2dbc6 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -57,18 +57,6 @@ QT_BEGIN_NAMESPACE -QQmlBinding *QQmlBinding::create(const QQmlPropertyData *property, const QString &str, QObject *obj, QQmlContext *ctxt) -{ - QQmlBinding *b = newBinding(QQmlEnginePrivate::get(ctxt), property); - b->setNotifyOnValueChanged(true); - b->QQmlJavaScriptExpression::setContext(QQmlContextData::get(ctxt)); - b->setScopeObject(obj); - - b->createQmlBinding(b->context(), obj, str, QString(), 0); - - return b; -} - QQmlBinding *QQmlBinding::create(const QQmlPropertyData *property, const QQmlScriptString &script, QObject *obj, QQmlContext *ctxt) { QQmlBinding *b = newBinding(QQmlEnginePrivate::get(ctxt), property); @@ -106,26 +94,11 @@ QQmlBinding *QQmlBinding::create(const QQmlPropertyData *property, const QQmlScr return b; } -QQmlBinding *QQmlBinding::create(const QQmlPropertyData *property, const QString &str, QObject *obj, QQmlContextData *ctxt) -{ - QQmlBinding *b = newBinding(QQmlEnginePrivate::get(ctxt), property); - - b->setNotifyOnValueChanged(true); - b->QQmlJavaScriptExpression::setContext(ctxt); - b->setScopeObject(obj); - - b->createQmlBinding(ctxt, obj, str, QString(), 0); - - return b; -} - QQmlBinding *QQmlBinding::create(const QQmlPropertyData *property, const QString &str, QObject *obj, - QQmlContextData *ctxt, const QString &url, quint16 lineNumber, - quint16 columnNumber) + QQmlContextData *ctxt, const QString &url, quint16 lineNumber) { QQmlBinding *b = newBinding(QQmlEnginePrivate::get(ctxt), property); - Q_UNUSED(columnNumber); b->setNotifyOnValueChanged(true); b->QQmlJavaScriptExpression::setContext(ctxt); b->setScopeObject(obj); diff --git a/src/qml/qml/qqmlbinding_p.h b/src/qml/qml/qqmlbinding_p.h index 6d42a8ea8a..3454adaf50 100644 --- a/src/qml/qml/qqmlbinding_p.h +++ b/src/qml/qml/qqmlbinding_p.h @@ -72,11 +72,9 @@ class Q_QML_PRIVATE_EXPORT QQmlBinding : public QQmlJavaScriptExpression, { friend class QQmlAbstractBinding; public: - static QQmlBinding *create(const QQmlPropertyData *, const QString &, QObject *, QQmlContext *); static QQmlBinding *create(const QQmlPropertyData *, const QQmlScriptString &, QObject *, QQmlContext *); - static QQmlBinding *create(const QQmlPropertyData *, const QString &, QObject *, QQmlContextData *); static QQmlBinding *create(const QQmlPropertyData *, const QString &, QObject *, QQmlContextData *, - const QString &url, quint16 lineNumber, quint16 columnNumber); + const QString &url = QString(), quint16 lineNumber = 0); static QQmlBinding *create(const QQmlPropertyData *, const QV4::Value &, QObject *, QQmlContextData *); ~QQmlBinding(); diff --git a/src/quick/designer/qquickdesignercustomobjectdata.cpp b/src/quick/designer/qquickdesignercustomobjectdata.cpp index e37254d165..ca9c1259fd 100644 --- a/src/quick/designer/qquickdesignercustomobjectdata.cpp +++ b/src/quick/designer/qquickdesignercustomobjectdata.cpp @@ -258,7 +258,7 @@ void QQuickDesignerCustomObjectData::setPropertyBinding(QQmlContext *context, if (property.isProperty()) { QQmlBinding *binding = QQmlBinding::create(&QQmlPropertyPrivate::get(property)->core, - expression, object(), context); + expression, object(), QQmlContextData::get(context)); binding->setTarget(property); binding->setNotifyOnValueChanged(true); diff --git a/src/quick/qtquick2.cpp b/src/quick/qtquick2.cpp index 1f9305ccba..226e7bf219 100644 --- a/src/quick/qtquick2.cpp +++ b/src/quick/qtquick2.cpp @@ -130,6 +130,7 @@ void QQmlQtQuick2DebugStatesDelegate::updateBinding(QQmlContext *context, const QString &fileName, int line, int column, bool *inBaseState) { + Q_UNUSED(column); typedef QPointer<QQuickState> QuickStatePointer; QObject *object = property.object(); QString propertyName = property.name(); @@ -144,7 +145,7 @@ void QQmlQtQuick2DebugStatesDelegate::updateBinding(QQmlContext *context, newBinding = QQmlBinding::create(&QQmlPropertyPrivate::get(property)->core, expression.toString(), object, QQmlContextData::get(context), fileName, - line, column); + line); newBinding->setTarget(property); } diff --git a/src/quick/util/qquickpropertychanges.cpp b/src/quick/util/qquickpropertychanges.cpp index 37a910876e..331ba32365 100644 --- a/src/quick/util/qquickpropertychanges.cpp +++ b/src/quick/util/qquickpropertychanges.cpp @@ -462,7 +462,7 @@ QQuickPropertyChanges::ActionList QQuickPropertyChanges::actions() // QQmlBinding *newBinding = e.id != QQmlBinding::Invalid ? QQmlBinding::createBinding(e.id, object(), qmlContext(this)) : 0; if (!newBinding) newBinding = QQmlBinding::create(&QQmlPropertyPrivate::get(prop)->core, - e.expression, object(), context, e.url.toString(), e.line, e.column); + e.expression, object(), context, e.url.toString(), e.line); if (d->isExplicit) { // in this case, we don't want to assign a binding, per se, @@ -629,7 +629,7 @@ void QQuickPropertyChanges::changeExpression(const QString &name, const QString auto prop = d->property(name); QQmlBinding *newBinding = QQmlBinding::create( &QQmlPropertyPrivate::get(prop)->core, expression, object(), - qmlContext(this)); + QQmlContextData::get(qmlContext(this))); newBinding->setTarget(prop); QQmlPropertyPrivate::setBinding(newBinding, QQmlPropertyPrivate::None, QQmlPropertyData::DontRemoveBinding | QQmlPropertyData::BypassInterceptor); } @@ -651,7 +651,7 @@ void QQuickPropertyChanges::changeExpression(const QString &name, const QString auto prop = d->property(name); QQmlBinding *newBinding = QQmlBinding::create( &QQmlPropertyPrivate::get(prop)->core, expression, object(), - qmlContext(this)); + QQmlContextData::get(qmlContext(this))); newBinding->setTarget(prop); QQmlPropertyPrivate::setBinding(newBinding, QQmlPropertyPrivate::None, QQmlPropertyData::DontRemoveBinding | QQmlPropertyData::BypassInterceptor); } else { @@ -664,7 +664,7 @@ void QQuickPropertyChanges::changeExpression(const QString &name, const QString QQmlBinding *newBinding = QQmlBinding::create( &QQmlPropertyPrivate::get(action.property)->core, expression, - object(), qmlContext(this)); + object(), QQmlContextData::get(qmlContext(this))); if (d->isExplicit) { // don't assign the binding, merely evaluate the expression. // XXX TODO: add a static QQmlJavaScriptExpression::evaluate(QString) |
