diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-05-05 04:38:55 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-05-05 04:38:55 (GMT) |
commit | ce9bc843443f2c61361afa75a62a7d39029557e6 (patch) | |
tree | a097566f26f14a1e0d2aa650cb803beb6ed1bddb /tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp | |
parent | 02df0ce446a89298109e1c7d0ef1e790d41d442f (diff) | |
download | Qt-ce9bc843443f2c61361afa75a62a7d39029557e6.zip Qt-ce9bc843443f2c61361afa75a62a7d39029557e6.tar.gz Qt-ce9bc843443f2c61361afa75a62a7d39029557e6.tar.bz2 |
QList<QObject*> models now update their properties when they change.
Task-number: QTBUG-10348
Diffstat (limited to 'tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp index 8be7d80..e6b2fdd 100644 --- a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp +++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp @@ -185,15 +185,24 @@ void tst_QDeclarativeRepeater::numberModel() delete canvas; } +class MyObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(int idx READ idx CONSTANT) +public: + MyObject(int i) : QObject(), m_idx(i) {} + + int idx() const { return m_idx; } + + int m_idx; +}; + void tst_QDeclarativeRepeater::objectList() { QDeclarativeView *canvas = createView(); - QObjectList data; - for(int i=0; i<100; i++){ - data << new QObject(); - data.back()->setProperty("idx", i); - } + for(int i=0; i<100; i++) + data << new MyObject(i); QDeclarativeContext *ctxt = canvas->rootContext(); ctxt->setContextProperty("testData", QVariant::fromValue(data)); |