diff options
author | Lars Knoll <lars.knoll@qt.io> | 2016-12-02 15:19:45 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2016-12-09 14:01:49 +0000 |
commit | c953f8b550b7ea9e7989f9fddaaa14324354aea3 (patch) | |
tree | 02ec1179f225e7b8080136e9e9afc8d6da7fcc32 /src/qml/qml/qqmlbinding.cpp | |
parent | 421d21a0334002f6497ce105876856dc0647c8ff (diff) |
Avoid the creation of a FunctionObject for most bindings
Change-Id: Ia62d380945250015009d9c2b6ed65f6d830277ef
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlbinding.cpp')
-rw-r--r-- | src/qml/qml/qqmlbinding.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/qml/qml/qqmlbinding.cpp b/src/qml/qml/qqmlbinding.cpp index a8232904fe..aabdf00f6e 100644 --- a/src/qml/qml/qqmlbinding.cpp +++ b/src/qml/qml/qqmlbinding.cpp @@ -123,6 +123,21 @@ QQmlBinding *QQmlBinding::create(const QQmlPropertyData *property, const QV4::Fu return b; } +QQmlBinding *QQmlBinding::create(const QQmlPropertyData *property, QV4::Function *function, + QObject *obj, QQmlContextData *ctxt, QV4::QmlContext *sharedContext) +{ + QQmlBinding *b = newBinding(QQmlEnginePrivate::get(ctxt), property); + + b->setNotifyOnValueChanged(true); + b->QQmlJavaScriptExpression::setContext(ctxt); + b->setScopeObject(obj); + + Q_ASSERT(sharedContext); + b->setupFunction(sharedContext, function); + + return b; +} + QQmlBinding::~QQmlBinding() { } |