aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/testtypes.h
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-06-30 13:06:19 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2020-08-12 15:52:10 +0200
commitf358188cbd2e47f82d7de3612181e628e1f1c05c (patch)
tree8befff9d83c4e96bab0b2e9af7727238b2e9be87 /tests/auto/qml/qqmlecmascript/testtypes.h
parent26884a4f34cfe6bc10daa19f2096aa49ed0a31f2 (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.h')
-rw-r--r--tests/auto/qml/qqmlecmascript/testtypes.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index 514dfb6f8f..725624781b 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -1746,6 +1746,15 @@ public slots:
void selection(const QItemSelection &is, int n = 0) { funcCalled = QLatin1String("QItemSelection"); }
};
+struct ClassWithQProperty2 : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(float value)
+public:
+ void callback();
+ QNotifiedProperty<float, &ClassWithQProperty2::callback> value;
+};
+
void registerTypes();
#endif // TESTTYPES_H