diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2011-02-08 10:57:34 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2011-02-08 10:57:34 (GMT) |
commit | eb7958c65b09569c2531d2c443a6d0fe0b507d97 (patch) | |
tree | 91544e4a4cf5c65b3acec7c219ebe63176a14994 /src/declarative/graphicsitems/qdeclarativegridview.cpp | |
parent | ef998bca70a799806c5754edfa49ea625881bc3e (diff) | |
parent | 44298c848ac254fe1942eb32eed7651dec5bf0e3 (diff) | |
download | Qt-eb7958c65b09569c2531d2c443a6d0fe0b507d97.zip Qt-eb7958c65b09569c2531d2c443a6d0fe0b507d97.tar.gz Qt-eb7958c65b09569c2531d2c443a6d0fe0b507d97.tar.bz2 |
Merge branch 'master-upstream'
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativegridview.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativegridview.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 89d7493..4c04a6b 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -2165,6 +2165,7 @@ void QDeclarativeGridView::positionViewAtIndex(int index, int mode) if (d->layoutScheduled) d->layout(); qreal pos = d->position(); + qreal maxExtent = d->flow == QDeclarativeGridView::LeftToRight ? -maxYExtent() : -maxXExtent(); FxGridItem *item = d->visibleItem(index); if (!item) { int itemPos = d->rowPosAt(index); @@ -2172,7 +2173,7 @@ void QDeclarativeGridView::positionViewAtIndex(int index, int mode) QList<FxGridItem*> oldVisible = d->visibleItems; d->visibleItems.clear(); d->visibleIndex = index - index % d->columns; - d->setPosition(itemPos); + d->setPosition(qMin(qreal(itemPos), maxExtent)); // now release the reference to all the old visible items. for (int i = 0; i < oldVisible.count(); ++i) d->releaseItem(oldVisible.at(i)); @@ -2202,7 +2203,6 @@ void QDeclarativeGridView::positionViewAtIndex(int index, int mode) if (itemPos < pos) pos = itemPos; } - qreal maxExtent = d->flow == QDeclarativeGridView::LeftToRight ? -maxYExtent() : -maxXExtent(); pos = qMin(pos, maxExtent); qreal minExtent = d->flow == QDeclarativeGridView::LeftToRight ? -minYExtent() : -minXExtent(); pos = qMax(pos, minExtent); |