diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-06-30 13:06:19 +0200 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2020-08-12 15:52:10 +0200 |
commit | f358188cbd2e47f82d7de3612181e628e1f1c05c (patch) | |
tree | 8befff9d83c4e96bab0b2e9af7727238b2e9be87 /tests/auto/qml/qqmlecmascript/testtypes.cpp | |
parent | 26884a4f34cfe6bc10daa19f2096aa49ed0a31f2 (diff) |
Do not set QQmlPropertyBinding until we reach finalize
If we install the binding eagerly, context properties cannot be resolved
yet, as the context object has not been created so far. This causes
issues with a QNotifiedProperty using a callback which accesses the
current value, and thus forcing the binding evaluation while the object
creation is still ongoing.
Change-Id: I3bf3def04cd044371cb757a1854a3224a9c669b8
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/testtypes.cpp')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/testtypes.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.cpp b/tests/auto/qml/qqmlecmascript/testtypes.cpp index 2059650584..e7f2756ec3 100644 --- a/tests/auto/qml/qqmlecmascript/testtypes.cpp +++ b/tests/auto/qml/qqmlecmascript/testtypes.cpp @@ -456,6 +456,11 @@ void FloatingQObject::componentComplete() Q_ASSERT(!parent()); } +void ClassWithQProperty2::callback() +{ + Q_UNUSED(this->value.value()); // force evaluation +} + void registerTypes() { qmlRegisterType<MyQmlObject>("Qt.test", 1,0, "MyQmlObjectAlias"); @@ -550,6 +555,7 @@ void registerTypes() qmlRegisterType<ClashingNames>("Qt.test", 1, 0, "ClashingNames"); qmlRegisterType<ClassWithQProperty>("Qt.test", 1, 0, "ClassWithQProperty"); + qmlRegisterType<ClassWithQProperty2>("Qt.test", 1, 0, "ClassWithQProperty2"); } #include "testtypes.moc" |