aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlecmascript/testtypes.h
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2021-02-17 12:36:50 +0100
committerFabian Kosmale <fabian.kosmale@qt.io>2021-02-19 18:10:23 +0100
commit2707910edb6311c1c50253ef80def9e161ea35f6 (patch)
tree7fb265e9ad8ca250124234b6d1d79709cd24baad /tests/auto/qml/qqmlecmascript/testtypes.h
parent258077e00eb8f3f4b0ef21a9a0395268b6c86532 (diff)
QV4QObjectWrapper: handle bindable properties
A function created by Qt.binding should lead to the binding being set (and replacing any previously existing binding). This was not the case for bindable properties so far. For those, we would have kept any existing C++ or QQmlPropertyBinding binding, and instead created a brand new QML binding which would have been set in addition. This patch also introduces a new class, QQmlPropertyBindingJSForBoundFunction, which is used to handle the case where the binding function is not a simple function, but has its parameters bound instead. Change-Id: Ia1417162b9822efb3f17ca4a6ecc02f959392927 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.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/testtypes.h b/tests/auto/qml/qqmlecmascript/testtypes.h
index 7074ffaa10..0124b6c604 100644
--- a/tests/auto/qml/qqmlecmascript/testtypes.h
+++ b/tests/auto/qml/qqmlecmascript/testtypes.h
@@ -1781,6 +1781,30 @@ public:
// QNotifiedProperty<float, &ClassWithQProperty2::callback> value;
};
+struct QPropertyQtBindingTester : public QObject
+{
+ Q_OBJECT
+public:
+ Q_PROPERTY(int nonBound READ nonBound WRITE setNonBound BINDABLE bindableNonBound)
+ Q_PROPERTY(int simple MEMBER simple BINDABLE bindableSimple)
+ Q_PROPERTY(int complex MEMBER complex BINDABLE bindableComplex)
+ Q_PROPERTY(int readOnlyBindable MEMBER readOnlyBindable BINDABLE bindableReadOnlyBindable)
+
+ int nonBound() { return m_nonBound; }
+
+ void setNonBound(int i) {m_nonBound = i;}
+
+ QBindable<int> bindableNonBound() { return &m_nonBound; }
+ QBindable<int> bindableSimple() { return &simple; }
+ QBindable<int> bindableComplex() {return &complex; }
+ QBindable<int> bindableReadOnlyBindable() const {return &readOnlyBindable; }
+
+ QProperty<int> readOnlyBindable;
+ QProperty<int> m_nonBound;
+ QProperty<int> simple;
+ QProperty<int> complex;
+};
+
void registerTypes();
#endif // TESTTYPES_H