summaryrefslogtreecommitdiffstats
path: root/tests/auto/qmetaobject/tst_qmetaobject.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-07-29 08:13:24 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-07-31 01:16:34 (GMT)
commit29202f033c87b5efe305e606805a26c59886875b (patch)
tree6d0b770e58a67648f64fd90c6be9f5e2ee45c5f6 /tests/auto/qmetaobject/tst_qmetaobject.cpp
parentf5acc7b83f79c0bce554a6e4fe2d9e6ebb4b582b (diff)
downloadQt-29202f033c87b5efe305e606805a26c59886875b.zip
Qt-29202f033c87b5efe305e606805a26c59886875b.tar.gz
Qt-29202f033c87b5efe305e606805a26c59886875b.tar.bz2
Add CONSTANT attribute to Q_PROPERTY()
This will be used by the declarative module to determine if a property lacking a NOTIFY signal is truly constant, or just missing a NOTIFY signal. Reviewed-by: Roberto Raggi
Diffstat (limited to 'tests/auto/qmetaobject/tst_qmetaobject.cpp')
-rw-r--r--tests/auto/qmetaobject/tst_qmetaobject.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/qmetaobject/tst_qmetaobject.cpp b/tests/auto/qmetaobject/tst_qmetaobject.cpp
index dea0ffb..f4cff2b 100644
--- a/tests/auto/qmetaobject/tst_qmetaobject.cpp
+++ b/tests/auto/qmetaobject/tst_qmetaobject.cpp
@@ -108,6 +108,7 @@ class tst_QMetaObject : public QObject
Q_PROPERTY(int value6 READ value6 NOTIFY value6Changed)
Q_PROPERTY(MyStruct value7 READ value7 WRITE setVal7 NOTIFY value7Changed)
Q_PROPERTY(int value8 READ value8 NOTIFY value8Changed)
+ Q_PROPERTY(int value9 READ value9 CONSTANT)
public:
enum EnumType { EnumType1 };
@@ -137,6 +138,8 @@ public:
int value8() const { return 1; }
+ int value9() const { return 1; }
+
QList<QVariant> value4;
QVariantList value5;
@@ -159,6 +162,7 @@ private slots:
void customPropertyType();
void checkScope();
void propertyNotify();
+ void propertyConstant();
void stdSet();
void classInfo();
@@ -785,6 +789,19 @@ void tst_QMetaObject::propertyNotify()
QCOMPARE(signal.signature(), (const char *)0);
}
+void tst_QMetaObject::propertyConstant()
+{
+ const QMetaObject *mo = metaObject();
+
+ QMetaProperty prop = mo->property(mo->indexOfProperty("value8"));
+ QVERIFY(prop.isValid());
+ QVERIFY(!prop.isConstant());
+
+ prop = mo->property(mo->indexOfProperty("value9"));
+ QVERIFY(prop.isValid());
+ QVERIFY(prop.isConstant());
+}
+
class ClassInfoTestObjectA : public QObject
{
Q_OBJECT