From c84227fbd5e068859f8de15e4c522b076885b9dc Mon Sep 17 00:00:00 2001 From: Aaron Kennedy Date: Wed, 14 Oct 2009 15:15:10 +1000 Subject: Add list accessors for Item::children and Item::resources --- src/declarative/fx/qfxitem.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/declarative/fx/qfxitem.cpp b/src/declarative/fx/qfxitem.cpp index 6324724..903fad7 100644 --- a/src/declarative/fx/qfxitem.cpp +++ b/src/declarative/fx/qfxitem.cpp @@ -1483,8 +1483,8 @@ void QFxItemPrivate::resources_removeAt(int) int QFxItemPrivate::resources_count() const { - // ### - return 0; + Q_Q(const QFxItem); + return q->children().count(); } void QFxItemPrivate::resources_append(QObject *o) @@ -1498,10 +1498,14 @@ void QFxItemPrivate::resources_insert(int, QObject *) // ### } -QObject *QFxItemPrivate::resources_at(int) const +QObject *QFxItemPrivate::resources_at(int idx) const { - // ### - return 0; + Q_Q(const QFxItem); + QObjectList children = q->children(); + if (idx < children.count()) + return children.at(idx); + else + return 0; } void QFxItemPrivate::resources_clear() @@ -1516,8 +1520,8 @@ void QFxItemPrivate::children_removeAt(int) int QFxItemPrivate::children_count() const { - // ### - return 0; + Q_Q(const QFxItem); + return q->childItems().count(); } void QFxItemPrivate::children_append(QFxItem *i) @@ -1531,10 +1535,14 @@ void QFxItemPrivate::children_insert(int, QFxItem *) // ### } -QFxItem *QFxItemPrivate::children_at(int) const +QFxItem *QFxItemPrivate::children_at(int idx) const { - // ### - return 0; + Q_Q(const QFxItem); + QList children = q->childItems(); + if (idx < children.count()) + return qobject_cast(children.at(idx)); + else + return 0; } void QFxItemPrivate::children_clear() -- cgit v0.12