summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/layouts
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-08-19 04:22:45 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-08-19 04:22:45 (GMT)
commitb763dee21dc82fa2abb2f9f038a0253e4e8ed848 (patch)
tree1494bb35fec768d499786286d735e5d601a69cd4 /tests/auto/declarative/layouts
parente19fa69859c1abe8da0623c502d012cff214e1c4 (diff)
downloadQt-b763dee21dc82fa2abb2f9f038a0253e4e8ed848.zip
Qt-b763dee21dc82fa2abb2f9f038a0253e4e8ed848.tar.gz
Qt-b763dee21dc82fa2abb2f9f038a0253e4e8ed848.tar.bz2
Update autotests
Not so much that they pass (or even run) of course. Just making the id change that was needed in the layouts test to all the other copy and pasted findItem functions.
Diffstat (limited to 'tests/auto/declarative/layouts')
-rw-r--r--tests/auto/declarative/layouts/tst_layouts.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp
index 466a7de..cd4678e 100644
--- a/tests/auto/declarative/layouts/tst_layouts.cpp
+++ b/tests/auto/declarative/layouts/tst_layouts.cpp
@@ -21,7 +21,7 @@ private slots:
private:
QFxView *createView(const QString &filename);
template<typename T>
- T *findItem(QFxItem *parent, const QString &id, int index=0);
+ T *findItem(QFxItem *parent, const QString &id, int index=-1);
};
tst_QFxLayouts::tst_QFxLayouts()
@@ -197,16 +197,19 @@ QFxView *tst_QFxLayouts::createView(const QString &filename)
}
/*
- Find an item with the specified id. If index is supplied then the
+ Find an item with the specified objectName. If index is supplied then the
item must also evaluate the {index} expression equal to index
*/
template<typename T>
-T *tst_QFxLayouts::findItem(QFxItem *parent, const QString &id, int index)
+T *tst_QFxLayouts::findItem(QFxItem *parent, const QString &objectName, int index)
{
const QMetaObject &mo = T::staticMetaObject;
- for (int i = 0; i < parent->children()->count(); ++i) {
- QFxItem *item = parent->children()->at(i);
- if (mo.cast(item) && (id.isEmpty() || item->id() == id)) {
+ for (int i = 0; i < parent->QGraphicsObject::children().count(); ++i) {
+ QFxItem *item = qobject_cast<QFxItem*>(parent->QGraphicsObject::children().at(i));
+ if(!item)
+ continue;
+ //qDebug() << item << item->objectName();
+ if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) {
if (index != -1) {
QmlExpression e(qmlContext(item), "index", item);
e.setTrackChange(false);
@@ -216,7 +219,7 @@ T *tst_QFxLayouts::findItem(QFxItem *parent, const QString &id, int index)
return static_cast<T*>(item);
}
}
- item = findItem<T>(item, id, index);
+ item = findItem<T>(item, objectName, index);
if (item)
return static_cast<T*>(item);
}