summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Alpert <alan.alpert@nokia.com>2009-09-23 04:45:47 (GMT)
committerAlan Alpert <alan.alpert@nokia.com>2009-09-23 04:45:47 (GMT)
commit8302f03e137a73543ab52ff451781617ce8a8760 (patch)
treeb53a15bff54567d6b0210bbe5d07fb0ff2de1727
parent9d605890a9e25623926c2dfff6a287093ff93778 (diff)
downloadQt-8302f03e137a73543ab52ff451781617ce8a8760.zip
Qt-8302f03e137a73543ab52ff451781617ce8a8760.tar.gz
Qt-8302f03e137a73543ab52ff451781617ce8a8760.tar.bz2
Repeater is more consistent with its docs
Task-number: QT-2030 Reviewed-by: Yann Bodson
-rw-r--r--src/declarative/fx/qfxrepeater.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/src/declarative/fx/qfxrepeater.cpp b/src/declarative/fx/qfxrepeater.cpp
index 84804ce..5ef7b10 100644
--- a/src/declarative/fx/qfxrepeater.cpp
+++ b/src/declarative/fx/qfxrepeater.cpp
@@ -282,14 +282,26 @@ void QFxRepeater::regenerate()
if (!d->model || !d->model->count() || !d->model->isValid() || !parentItem() || !isComponentComplete())
return;
- if (d->model) {
- for (int ii = 0; ii < count(); ++ii) {
- QFxItem *item = d->model->item(ii);
- if (item) {
- item->setParent(parentItem());
- d->deletables << item;
- }
+ //In order to do the insertion like the examples, we have to be at the
+ //same point in the childItems() list. Temporary measure until we think of something better
+ int pos = parentItem()->childItems().indexOf(this);
+ Q_ASSERT(pos != -1);
+ QList<QGraphicsItem*> otherChildren;
+ for (int ii = pos+1; ii < parentItem()->childItems().count(); ii++){
+ QGraphicsItem* otherChild = parentItem()->childItems()[ii];
+ otherChildren << otherChild;
+ otherChild->setParentItem(0);
+ }
+
+ for (int ii = 0; ii < count(); ++ii) {
+ QFxItem *item = d->model->item(ii);
+ if (item) {
+ item->setParent(parentItem());
+ d->deletables << item;
}
}
+
+ foreach(QGraphicsItem* other, otherChildren)
+ other->setParentItem(parentItem());
}
QT_END_NAMESPACE