diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-06-23 06:13:18 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-06-23 06:13:18 (GMT) |
commit | a60f8832425aafbe6c5e8be3c25fefc9f8f2f87b (patch) | |
tree | d3dc3a72de7b1d19671e2d006dc201842e7d85f0 /src/declarative/graphicsitems/qdeclarativegridview.cpp | |
parent | 3e209785c3f027973089ccbebc6528501f416f2b (diff) | |
download | Qt-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/qdeclarativegridview.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativegridview.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 3792595..8e53237 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -2037,6 +2037,8 @@ void QDeclarativeGridView::positionViewAtIndex(int index, int mode) if (mode < Beginning || mode > Contain) return; + if (d->layoutScheduled) + d->layout(); qreal pos = d->position(); FxGridItem *item = d->visibleItem(index); if (!item) { @@ -2079,6 +2081,8 @@ void QDeclarativeGridView::positionViewAtIndex(int index, int mode) pos = qMin(pos, maxExtent); qreal minExtent = d->flow == QDeclarativeGridView::LeftToRight ? -minYExtent() : -minXExtent(); pos = qMax(pos, minExtent); + d->moveReason = QDeclarativeGridViewPrivate::Other; + cancelFlick(); d->setPosition(pos); } d->fixupPosition(); @@ -2113,10 +2117,15 @@ void QDeclarativeGridView::componentComplete() d->updateGrid(); if (d->isValid()) { refill(); + d->moveReason = QDeclarativeGridViewPrivate::SetIndex; if (d->currentIndex < 0) d->updateCurrent(0); else d->updateCurrent(d->currentIndex); + if (d->highlight) { + d->highlight->setPosition(d->currentItem->colPos(), d->currentItem->rowPos()); + d->updateTrackedItem(); + } d->fixupPosition(); } } |