summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems/qdeclarativelistview.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-06-23 06:13:18 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-06-23 06:13:18 (GMT)
commita60f8832425aafbe6c5e8be3c25fefc9f8f2f87b (patch)
treed3dc3a72de7b1d19671e2d006dc201842e7d85f0 /src/declarative/graphicsitems/qdeclarativelistview.cpp
parent3e209785c3f027973089ccbebc6528501f416f2b (diff)
downloadQt-a60f8832425aafbe6c5e8be3c25fefc9f8f2f87b.zip
Qt-a60f8832425aafbe6c5e8be3c25fefc9f8f2f87b.tar.gz
Qt-a60f8832425aafbe6c5e8be3c25fefc9f8f2f87b.tar.bz2
Ensure the view is correctly positioned at component complete.
If a currentIndex has been specified, ensure the view starts at the correct position immediately, rather than scrolling to it after startup.
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativelistview.cpp')
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index 06a3239..35e6bab 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -2448,6 +2448,8 @@ void QDeclarativeListView::positionViewAtIndex(int index, int mode)
if (mode < Beginning || mode > Contain)
return;
+ if (d->layoutScheduled)
+ d->layout();
qreal pos = d->position();
FxListItem *item = d->visibleItem(index);
if (!item) {
@@ -2491,6 +2493,8 @@ void QDeclarativeListView::positionViewAtIndex(int index, int mode)
pos = qMin(pos, maxExtent);
qreal minExtent = d->orient == QDeclarativeListView::Vertical ? -minYExtent() : -minXExtent();
pos = qMax(pos, minExtent);
+ d->moveReason = QDeclarativeListViewPrivate::Other;
+ cancelFlick();
d->setPosition(pos);
}
d->fixupPosition();
@@ -2529,6 +2533,10 @@ void QDeclarativeListView::componentComplete()
d->updateCurrent(0);
else
d->updateCurrent(d->currentIndex);
+ if (d->highlight) {
+ d->highlight->setPosition(d->currentItem->position());
+ d->updateTrackedItem();
+ }
d->fixupPosition();
}
}