automatically assigned to this property.
*/
-int QQuickItemPrivate::data_count(QQmlListProperty<QObject> *prop)
+int QQuickItemPrivate::data_count(QQmlListProperty<QObject> *property)
{
- Q_UNUSED(prop);
- // XXX todo
- return 0;
+ QQuickItem *item = static_cast<QQuickItem*>(property->object);
+ QQuickItemPrivate *privateItem = QQuickItemPrivate::get(item);
+ QQmlListProperty<QObject> resourcesProperty = privateItem->resources();
+ QQmlListProperty<QQuickItem> childrenProperty = privateItem->children();
+
+ return resources_count(&resourcesProperty) + children_count(&childrenProperty);
}
-QObject *QQuickItemPrivate::data_at(QQmlListProperty<QObject> *prop, int i)
+QObject *QQuickItemPrivate::data_at(QQmlListProperty<QObject> *property, int i)
{
- Q_UNUSED(prop);
- Q_UNUSED(i);
- // XXX todo
+ QQuickItem *item = static_cast<QQuickItem*>(property->object);
+ QQuickItemPrivate *privateItem = QQuickItemPrivate::get(item);
+ QQmlListProperty<QObject> resourcesProperty = privateItem->resources();
+ QQmlListProperty<QQuickItem> childrenProperty = privateItem->children();
+
+ int resourcesCount = resources_count(&resourcesProperty);
+ if (i < resourcesCount)
+ return resources_at(&resourcesProperty, i);
+ const int j = i - resourcesCount;
+ if (j < children_count(&childrenProperty))
+ return children_at(&childrenProperty, j);
return 0;
}
-void QQuickItemPrivate::data_clear(QQmlListProperty<QObject> *prop)
+void QQuickItemPrivate::data_clear(QQmlListProperty<QObject> *property)
{
- Q_UNUSED(prop);
- // XXX todo
+ QQuickItem *item = static_cast<QQuickItem*>(property->object);
+ QQuickItemPrivate *privateItem = QQuickItemPrivate::get(item);
+ QQmlListProperty<QObject> resourcesProperty = privateItem->resources();
+ QQmlListProperty<QQuickItem> childrenProperty = privateItem->children();
+
+ resources_clear(&resourcesProperty);
+ children_clear(&childrenProperty);
}
QObject *QQuickItemPrivate::resources_at(QQmlListProperty<QObject> *prop, int index)