summaryrefslogtreecommitdiffstats
path: root/tests/auto/tools
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2013-03-01 15:48:32 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-02 12:58:18 +0100
commitb0e58a9008a01cd819d942ddc79534e8dd8ef8bd (patch)
tree5653794baf6a49bc7d5bb6a59157db72ddd0c270 /tests/auto/tools
parente786a347c8f8a90f5c5d0fa0d198e343e96c82d2 (diff)
Fix compilation of moc generated file with MEMBER properties
If the object has only MEMBER properties, without any other property specifying READ, the generated will fail to compile with this error: tst_moc.moc: In member function ‘virtual int ClassWithOneMember::qt_metacall(QMetaObject::Call, int, void**)’: tst_moc.moc:3810:42: error: ‘_v’ was not declared in this scope That's because the '_v' is only declared if 'needTempVarForGet' is set, and it should be set when we have a MEMBER property. Change-Id: I829fad3faf69654b5a3fd540857df19f4a9449d4 Reviewed-by: Gerhard Gappmeier <gerhard.gappmeier@ascolab.com> Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'tests/auto/tools')
-rw-r--r--tests/auto/tools/moc/tst_moc.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp
index af77e5c3ad..195361e007 100644
--- a/tests/auto/tools/moc/tst_moc.cpp
+++ b/tests/auto/tools/moc/tst_moc.cpp
@@ -547,7 +547,7 @@ private slots:
void returnRefs();
void memberProperties_data();
void memberProperties();
-
+ void memberProperties2();
void privateSignalConnection();
void finalClasses_data();
void finalClasses();
@@ -1893,6 +1893,23 @@ void tst_Moc::memberProperties()
}
}
+//this used to fail to compile
+class ClassWithOneMember : public QObject {
+ Q_PROPERTY(int member MEMBER member)
+ Q_OBJECT
+public:
+ int member;
+};
+
+void tst_Moc::memberProperties2()
+{
+ ClassWithOneMember o;
+ o.member = 442;
+ QCOMPARE(o.property("member").toInt(), 442);
+ QVERIFY(o.setProperty("member", 6666));
+ QCOMPARE(o.member, 6666);
+}
+
class SignalConnectionTester : public QObject
{
Q_OBJECT