summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-05-05 04:38:55 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-05-05 04:38:55 (GMT)
commitce9bc843443f2c61361afa75a62a7d39029557e6 (patch)
treea097566f26f14a1e0d2aa650cb803beb6ed1bddb /tests/auto
parent02df0ce446a89298109e1c7d0ef1e790d41d442f (diff)
downloadQt-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')
-rw-r--r--tests/auto/declarative/qdeclarativerepeater/data/objlist.qml2
-rw-r--r--tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp19
2 files changed, 15 insertions, 6 deletions
diff --git a/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml b/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml
index 17c5d8d..e1bd2e2 100644
--- a/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml
+++ b/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml
@@ -14,7 +14,7 @@ Rectangle {
property int instantiated: 0
Component {
Item{
- Component.onCompleted: {if(index!=model.idx) repeater.errors += 1; repeater.instantiated++}
+ Component.onCompleted: {if(index!=modelData.idx) repeater.errors += 1; repeater.instantiated++}
}
}
}
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));