aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickrepeater.cpp
diff options
context:
space:
mode:
authorJan Arve Saether <jan-arve.saether@theqtcompany.com>2015-04-22 10:49:45 +0200
committerJan Arve Sæther <jan-arve.saether@theqtcompany.com>2015-04-28 07:41:56 +0000
commit55dc72f8cf47c6b32c1f172f4dffcd5a3bc743e6 (patch)
tree1d89b2f367b1fddf7530b1eeb542ea1228a4f05b /src/quick/items/qquickrepeater.cpp
parent11f67b80c4eab4b1e3eb8e6b1e8b69e7a60e42a9 (diff)
Make Repeater emit items with right stacking order
When listening for Component.onCompleted on the items emitted by the Repeater, the items' stacking order was not properly set up. The stacking order was corrected after Component.onCompleted was emitted, which was undesirable in some cases. Task-number: QTBUG-45423 Change-Id: Ib96b3de81db556b09fb5fc8bd27ce19223014f7e Reviewed-by: Alan Alpert <aalpert@blackberry.com>
Diffstat (limited to 'src/quick/items/qquickrepeater.cpp')
-rw-r--r--src/quick/items/qquickrepeater.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/quick/items/qquickrepeater.cpp b/src/quick/items/qquickrepeater.cpp
index 9cddd9de0d..5333ad2f08 100644
--- a/src/quick/items/qquickrepeater.cpp
+++ b/src/quick/items/qquickrepeater.cpp
@@ -398,9 +398,17 @@ void QQuickRepeaterPrivate::requestItems()
void QQuickRepeater::createdItem(int index, QObject *)
{
Q_D(QQuickRepeater);
+ QObject *object = d->model->object(index, false);
+ QQuickItem *item = qmlobject_cast<QQuickItem*>(object);
+ emit itemAdded(index, item);
+}
+
+void QQuickRepeater::initItem(int index, QObject *object)
+{
+ Q_D(QQuickRepeater);
+ QQuickItem *item = qmlobject_cast<QQuickItem*>(object);
+
if (!d->deletables.at(index)) {
- QObject *object = d->model->object(index, false);
- QQuickItem *item = qmlobject_cast<QQuickItem*>(object);
if (!item) {
if (object) {
d->model->release(object);
@@ -426,17 +434,9 @@ void QQuickRepeater::createdItem(int index, QObject *)
}
item->stackBefore(after);
}
- emit itemAdded(index, item);
}
}
-void QQuickRepeater::initItem(int, QObject *object)
-{
- QQuickItem *item = qmlobject_cast<QQuickItem*>(object);
- if (item)
- item->setParentItem(parentItem());
-}
-
void QQuickRepeater::modelUpdated(const QQmlChangeSet &changeSet, bool reset)
{
Q_D(QQuickRepeater);