aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/qml/qqmlobjectcreator.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@qt.io>2020-03-24 11:21:25 +0100
committerSimon Hausmann <simon.hausmann@qt.io>2020-04-02 22:23:04 +0200
commite40098c5303e7af4b12c64093b120405c63fdf8d (patch)
tree9636894ed820567731f9b4dd41870392ce052a70 /src/qml/qml/qqmlobjectcreator.cpp
parent63bf6ac4c483cc64b48c410c6e1afb404f2bcbd1 (diff)
Add support for translation bindings on QProperty based properties
Change-Id: I439653123cdc96df97a1801664655c9d28a8b9b5 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/qml/qml/qqmlobjectcreator.cpp')
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 2ee2969d43..564835ff8b 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -919,9 +919,13 @@ bool QQmlObjectCreator::setPropertyBinding(const QQmlPropertyData *bindingProper
bs->takeExpression(expr);
} else if (bindingProperty->isQProperty()) {
- // ### TODO: support binding->isTranslationBinding()
- QV4::Function *runtimeFunction = compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex];
- auto qmlBinding = QQmlPropertyBinding::create(bindingProperty, runtimeFunction, _scopeObject, context, currentQmlContext());
+ QUntypedPropertyBinding qmlBinding;
+ if (binding->isTranslationBinding()) {
+ qmlBinding = QQmlTranslationPropertyBinding::create(bindingProperty, compilationUnit, binding);
+ } else {
+ QV4::Function *runtimeFunction = compilationUnit->runtimeFunctions[binding->value.compiledScriptIndex];
+ qmlBinding = QQmlPropertyBinding::create(bindingProperty, runtimeFunction, _scopeObject, context, currentQmlContext());
+ }
void *argv[] = { &qmlBinding };
_bindingTarget->qt_metacall(QMetaObject::SetQPropertyBinding, bindingProperty->coreIndex(), argv);
} else {