diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2015-06-10 14:28:57 +0200 |
---|---|---|
committer | Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> | 2015-06-12 11:36:32 +0000 |
commit | 7f85fb4654f0d6f9058336af53148d81fc700497 (patch) | |
tree | b2dfbcd56367c5a0397d1285ac3c996795d7e057 /tests/auto/corelib/kernel | |
parent | 55df2e54a5a770fe96cfaebf59081843edaca768 (diff) |
Allow types with a comma in Q_PROPERTY
This allows for example properties with QMap<Foo, Bar>
[ChangeLog][QtCore] Types in the Q_PROPERTY macro can now contain commas
(for example, QMap<Foo, Bar>)
Change-Id: Ibf5c8c9cf20a7c8b3dfec9e891fb8a9ca1bdba7c
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@theqtcompany.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/kernel')
-rw-r--r-- | tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp index a18c9eb370..4d54aa4dc8 100644 --- a/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp +++ b/tests/auto/corelib/kernel/qmetaproperty/tst_qmetaproperty.cpp @@ -46,6 +46,7 @@ class tst_QMetaProperty : public QObject Q_PROPERTY(int value8 READ value8) Q_PROPERTY(int value9 READ value9 CONSTANT) Q_PROPERTY(int value10 READ value10 FINAL) + Q_PROPERTY(QMap<int, int> map MEMBER map) private slots: void hasStdCppSet(); @@ -53,6 +54,7 @@ private slots: void isFinal(); void gadget(); void readAndWriteWithLazyRegistration(); + void mapProperty(); public: enum EnumType { EnumType1 }; @@ -65,6 +67,8 @@ public: int value8() const { return 1; } int value9() const { return 1; } int value10() const { return 1; } + + QMap<int, int> map; }; void tst_QMetaProperty::hasStdCppSet() @@ -182,6 +186,14 @@ void tst_QMetaProperty::readAndWriteWithLazyRegistration() QCOMPARE(o.property("write").value<CustomWriteObjectChild*>(), &data); } +void tst_QMetaProperty::mapProperty() +{ + map.insert(5, 9); + QVariant v1 = QVariant::fromValue(map); + QVariant v = property("map"); + QVERIFY(v.isValid()); + QCOMPARE(map, (v.value<QMap<int,int> >())); +} QTEST_MAIN(tst_QMetaProperty) #include "tst_qmetaproperty.moc" |