aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickitem.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/items/qquickitem.cpp')
-rw-r--r--src/quick/items/qquickitem.cpp54
1 files changed, 34 insertions, 20 deletions
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 783994666c..f213111ccd 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -2509,25 +2509,41 @@ void QQuickItemPrivate::data_append(QQmlListProperty<QObject> *prop, QObject *o)
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)
@@ -2593,12 +2609,6 @@ void QQuickItemPrivate::children_clear(QQmlListProperty<QQuickItem> *prop)
p->childItems.at(0)->setParentItem(0);
}
-void QQuickItemPrivate::visibleChildren_append(QQmlListProperty<QQuickItem>*, QQuickItem *self)
-{
- // do nothing
- qmlInfo(self) << "QQuickItem: visibleChildren property is readonly and cannot be assigned to.";
-}
-
int QQuickItemPrivate::visibleChildren_count(QQmlListProperty<QQuickItem> *prop)
{
QQuickItemPrivate *p = QQuickItemPrivate::get(static_cast<QQuickItem *>(prop->object));
@@ -3728,9 +3738,10 @@ QQmlListProperty<QQuickItem> QQuickItemPrivate::children()
*/
QQmlListProperty<QQuickItem> QQuickItemPrivate::visibleChildren()
{
- return QQmlListProperty<QQuickItem>(q_func(), 0, QQuickItemPrivate::visibleChildren_append,
- QQuickItemPrivate::visibleChildren_count,
- QQuickItemPrivate::visibleChildren_at);
+ return QQmlListProperty<QQuickItem>(q_func(),
+ 0,
+ QQuickItemPrivate::visibleChildren_count,
+ QQuickItemPrivate::visibleChildren_at);
}
@@ -6508,6 +6519,9 @@ bool QQuickItem::event(QEvent *ev)
} else if (ev->type() == QEvent::InputMethod) {
inputMethodEvent(static_cast<QInputMethodEvent *>(ev));
return true;
+ } else if (ev->type() == QEvent::StyleAnimationUpdate) {
+ update();
+ return true;
}
return QObject::event(ev);
}