diff options
author | Andrei Golubev <andrei.golubev@qt.io> | 2021-08-04 10:28:33 +0200 |
---|---|---|
committer | Andrei Golubev <andrei.golubev@qt.io> | 2021-08-06 17:25:50 +0200 |
commit | d4e62f2c5a0f7e2e47d3bdfd570094862b1c05c1 (patch) | |
tree | 0c37739a29b1e9519cf418c37a0c1aff627dd768 /tests/auto/tools/moc/tst_moc.cpp | |
parent | 6ba6e7585dff4198aa3e4b23035ba95fb988400f (diff) |
moc: Support BINDABLE for private properties
Hopefully we won't need it but let's have it still at least for
consistency
Change-Id: I72289e65e5e5613174ad4d98cf8d614f9caae8e6
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/tools/moc/tst_moc.cpp')
-rw-r--r-- | tests/auto/tools/moc/tst_moc.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 10c6a3ebc9..49053e8d0e 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -1569,6 +1569,7 @@ class PrivatePropertyTest : public QObject Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, QString blub4 MEMBER mBlub NOTIFY blub4Changed) Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, QString blub5 MEMBER mBlub NOTIFY blub5Changed) Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, QString blub6 MEMBER mConst CONSTANT) + Q_PRIVATE_PROPERTY(PrivatePropertyTest::d, int zap READ zap WRITE setZap BINDABLE bindableZap) class MyDPointer { public: MyDPointer() : mConst("const"), mBar(0), mPlop(0) {} @@ -1580,12 +1581,16 @@ class PrivatePropertyTest : public QObject void setBaz(int value) { mBaz = value; } QString blub() const { return mBlub; } void setBlub(const QString &value) { mBlub = value; } + int zap() { return mZap; } + void setZap(int zap) { mZap = zap; } + QBindable<int> bindableZap() { return QBindable<int>(&mZap); } QString mBlub; const QString mConst; private: int mBar; int mPlop; int mBaz; + QProperty<int> mZap; }; public: PrivatePropertyTest(QObject *parent = nullptr) : QObject(parent), mFoo(0), d (new MyDPointer) {} @@ -1617,6 +1622,12 @@ void tst_Moc::qprivateproperties() test.setProperty("baz", 4); QCOMPARE(test.property("baz"), QVariant::fromValue(4)); + + QMetaProperty zap = test.metaObject()->property(test.metaObject()->indexOfProperty("zap")); + QVERIFY(zap.isValid()); + QVERIFY(zap.isBindable()); + auto zapBindable = zap.bindable(&test); + QVERIFY(zapBindable.isBindable()); } void tst_Moc::warnOnPropertyWithoutREAD() |