diff options
-rw-r--r-- | tests/auto/declarative/qmlgraphicsrepeater/data/objlist.qml | 2 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp | 11 |
2 files changed, 8 insertions, 5 deletions
diff --git a/tests/auto/declarative/qmlgraphicsrepeater/data/objlist.qml b/tests/auto/declarative/qmlgraphicsrepeater/data/objlist.qml index ecc6d02..e6d0acb 100644 --- a/tests/auto/declarative/qmlgraphicsrepeater/data/objlist.qml +++ b/tests/auto/declarative/qmlgraphicsrepeater/data/objlist.qml @@ -14,7 +14,7 @@ Rectangle { property int instantiated: 0 Component { Item{ - Component.onCompleted: {if(index!=modelData.idx) repeater.errors += 1; repeater.instantiated++} + Component.onCompleted: {if(index!=model.idx) repeater.errors += 1; repeater.instantiated++} } } } diff --git a/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp b/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp index e8019d7..4297901 100644 --- a/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp +++ b/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp @@ -61,7 +61,7 @@ private slots: private: QmlView *createView(const QString &filename); template<typename T> - T *findItem(QObject *parent, const QString &id); + T *findItem(QmlGraphicsItem *parent, const QString &id); }; class TestObject : public QObject @@ -332,13 +332,16 @@ QmlView *tst_QmlGraphicsRepeater::createView(const QString &filename) } template<typename T> -T *tst_QmlGraphicsRepeater::findItem(QObject *parent, const QString &objectName) +T *tst_QmlGraphicsRepeater::findItem(QmlGraphicsItem *parent, const QString &objectName) { const QMetaObject &mo = T::staticMetaObject; if (mo.cast(parent) && (objectName.isEmpty() || parent->objectName() == objectName)) return static_cast<T*>(parent); - for (int i = 0; i < parent->children().count(); ++i) { - QmlGraphicsItem *item = findItem<T>(parent->children().at(i), objectName); + for (int i = 0; i < parent->childItems().count(); ++i) { + QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i)); + if (!child) + continue; + QmlGraphicsItem *item = findItem<T>(child, objectName); if (item) return static_cast<T*>(item); } |