aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/qml/qml/qqmlobjectcreator.cpp4
-rw-r--r--tests/auto/qml/qqmlecmascript/data/QPropertyBase.qml5
-rw-r--r--tests/auto/qml/qqmlecmascript/data/QPropertyOverwrite.qml11
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.h3
-rw-r--r--tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp14
5 files changed, 35 insertions, 2 deletions
diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp
index 43c639ce8d..2883cb3031 100644
--- a/src/qml/qml/qqmlobjectcreator.cpp
+++ b/src/qml/qml/qqmlobjectcreator.cpp
@@ -1423,12 +1423,12 @@ bool QQmlObjectCreator::finalize(QQmlInstantiationInterrupt &interrupt)
}
while (!sharedState->allQPropertyBindings.isEmpty()) {
- auto& [target, index, qmlBinding] = sharedState->allQPropertyBindings.last();
+ auto& [target, index, qmlBinding] = sharedState->allQPropertyBindings.first();
QUntypedBindable bindable;
void *argv[] = { &bindable };
target->qt_metacall(QMetaObject::BindableProperty, index, argv);
bindable.setBinding(qmlBinding);
- sharedState->allQPropertyBindings.pop_back();
+ sharedState->allQPropertyBindings.pop_front();
if (watcher.hasRecursed() || interrupt.shouldInterrupt())
return false;
}
diff --git a/tests/auto/qml/qqmlecmascript/data/QPropertyBase.qml b/tests/auto/qml/qqmlecmascript/data/QPropertyBase.qml
new file mode 100644
index 0000000000..40f29f589e
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/QPropertyBase.qml
@@ -0,0 +1,5 @@
+import Qt.test 1
+ClassWithQProperty {
+ value2: 42
+ value: value2
+}
diff --git a/tests/auto/qml/qqmlecmascript/data/QPropertyOverwrite.qml b/tests/auto/qml/qqmlecmascript/data/QPropertyOverwrite.qml
new file mode 100644
index 0000000000..fd8b2c3dfd
--- /dev/null
+++ b/tests/auto/qml/qqmlecmascript/data/QPropertyOverwrite.qml
@@ -0,0 +1,11 @@
+import Qt.test 1
+
+ClassWithQProperty {
+ id: root
+ value: 13
+
+ property QPropertyBase prop: QPropertyBase {
+ objectName: "test"
+ value: root.value
+ }
+}
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index 159038f851..7074ffaa10 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -1732,9 +1732,12 @@ struct ClassWithQProperty : public QObject
{
Q_OBJECT
Q_PROPERTY(float value MEMBER value BINDABLE bindableValue)
+ Q_PROPERTY(float value2 MEMBER value2 BINDABLE bindableValue2)
public:
QProperty<float> value;
+ QProperty<float> value2;
QBindable<float> bindableValue() { return QBindable<float>(&value); }
+ QBindable<float> bindableValue2() { return QBindable<float>(&value2); }
};
class VariantConvertObject : public QObject
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
index d7cb85a75d..37e3a33442 100644
--- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
+++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
@@ -382,6 +382,7 @@ private slots:
void semicolonAfterProperty();
void hugeStack();
void bindingOnQProperty();
+ void overwrittenBindingOnQProperty();
void aliasOfQProperty();
void bindingOnQPropertyContextProperty();
void bindingContainingQProperty();
@@ -9182,6 +9183,19 @@ void tst_qqmlecmascript::bindingOnQProperty()
QVERIFY(qprop.hasBinding());
}
+void tst_qqmlecmascript::overwrittenBindingOnQProperty()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine, testFileUrl("QPropertyOverwrite.qml"));
+ QVERIFY2(component.isReady(), qPrintable(component.errorString()));
+ QScopedPointer<QObject> root(component.create());
+ auto test = root->findChild<ClassWithQProperty *>("test");
+ QVERIFY(test);
+ QCOMPARE(test->value.value(), 13.f);
+ root->setProperty("value", 14.f);
+ QCOMPARE(test->value.value(), 14.0);
+}
+
void tst_qqmlecmascript::aliasOfQProperty() {
QQmlEngine engine;
QQmlComponent component(&engine, testFileUrl("aliasOfQProperty.qml"));