diff options
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)); |