diff options
-rw-r--r-- | src/tools/moc/moc.cpp | 1 | ||||
-rw-r--r-- | tests/auto/tools/moc/tst_moc.cpp | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/src/tools/moc/moc.cpp b/src/tools/moc/moc.cpp index 7300429fe0..726d1972f1 100644 --- a/src/tools/moc/moc.cpp +++ b/src/tools/moc/moc.cpp @@ -1060,6 +1060,7 @@ void Moc::createPropertyDef(PropertyDef &propDef) QByteArray v, v2; if (test(LPAREN)) { v = lexemUntil(RPAREN); + v = v.mid(1, v.length() - 2); // removes the '(' and ')' } else if (test(INTEGER_LITERAL)) { v = lexem(); if (l != "REVISION") diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 4fa98b6ecb..c113b7cd60 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -513,6 +513,8 @@ class tst_Moc : public QObject Q_PROPERTY(QString member4 MEMBER sMember NOTIFY member4Changed) Q_PROPERTY(QString member5 MEMBER sMember NOTIFY member5Changed) Q_PROPERTY(QString member6 MEMBER sConst CONSTANT) + Q_PROPERTY(QString sub1 MEMBER (sub.m_string)) + Q_PROPERTY(QString sub2 READ (sub.string) WRITE (sub.setString)) public: inline tst_Moc() : sConst("const") {} @@ -626,6 +628,13 @@ private: QString sMember; const QString sConst; PrivatePropertyTest *pPPTest; + + struct { + QString m_string; + void setString(const QString &s) { m_string = s; } + QString string() { return m_string; } + } sub; + }; void tst_Moc::initTestCase() @@ -2044,6 +2053,10 @@ void tst_Moc::memberProperties_data() << 1 << "blub5" << "blub5Changed(const QString&)" << "mno" << true << "mno"; QTest::newRow("private MEMBER property with CONSTANT") << 1 << "blub6" << "" << "test" << false << "const"; + QTest::newRow("sub1") + << 0 << "sub1" << "" << "helloSub1" << true << "helloSub1"; + QTest::newRow("sub2") + << 0 << "sub2" << "" << "helloSub2" << true << "helloSub2"; } void tst_Moc::memberProperties() |