summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorFabian Kosmale <fabian.kosmale@qt.io>2020-07-13 15:20:46 +0200
committerFabian Kosmale <fabian.kosmale@qt.io>2020-07-14 17:06:46 +0200
commit8cdaeb26552313e7b9d67fa062a3d9ff597c2e06 (patch)
tree7ba18ecdb22417bb38c756f5379c6dd991b5000a /tests/auto
parentbb6a73260ec8272647265f42180963604ad0f755 (diff)
moc: allow wrapper generation for QProperty in pimpl class
Previously, only QNotifiedProperty was supported. As moc cannot determine by itself whether the backing property is a QProperty or a QNotifiedProperty, allow NOTIFY false to indicate that it is a plain QProperty. For symmetry, NOTIFY true is also allowed and means that the backing property is a QNotifiedProperty. Change-Id: I66f3105c976ef084198ce8658bc07499a3cb1cd8 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index 4ea376df68..1432018647 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -4170,11 +4170,13 @@ class ClassWithPrivateQPropertyShim :public QObject
Q_OBJECT
public:
Q_PRIVATE_QPROPERTY(d_func(), int, testProperty, setTestProperty, NOTIFY testPropertyChanged)
+ Q_PRIVATE_QPROPERTY(d_func(), int, testProperty2, setTestProperty2, NOTIFY false)
Q_PRIVATE_QPROPERTY(d_func(), int, lazyTestProperty, setLazyTestProperty,
NOTIFY lazyTestPropertyChanged STORED false)
Q_PRIVATE_QPROPERTIES_BEGIN
Q_PRIVATE_QPROPERTY_IMPL(testProperty)
+ Q_PRIVATE_QPROPERTY_IMPL(testProperty2)
Q_PRIVATE_QPROPERTY_IMPL(lazyTestProperty)
Q_PRIVATE_QPROPERTIES_END
@@ -4192,6 +4194,7 @@ public:
void onTestPropertyChanged() { q->testPropertyChanged(); }
QNotifiedProperty<int, &Private::onTestPropertyChanged> testProperty;
+ QProperty<int> testProperty2;
void onLazyTestPropertyChanged() { q->lazyTestPropertyChanged(); }
@@ -4258,6 +4261,10 @@ void tst_Moc::privateQPropertyShim()
testObject.setLazyTestProperty(400);
QVERIFY(!testObject.lazyTestProperty.hasBinding());
QCOMPARE(testObject.lazyTestProperty(), 400);
+
+ // mo generates correct code for plain QProperty in PIMPL
+ testObject.testProperty2.setValue(42);
+ QCOMPARE(testObject.testProperty2.value(), 42);
}
QTEST_MAIN(tst_Moc)