summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2010-08-26 06:00:37 (GMT)
committerMartin Jones <martin.jones@nokia.com>2010-08-26 06:00:37 (GMT)
commitdac9c7f42765a46d445aae35fd0e85b402ceb164 (patch)
treec3236b31f4763c9b6246652c0ad1fb410df52761 /src
parent58a76965e20c4c66ab2dc9cf73aa72b1cfddfbeb (diff)
downloadQt-dac9c7f42765a46d445aae35fd0e85b402ceb164.zip
Qt-dac9c7f42765a46d445aae35fd0e85b402ceb164.tar.gz
Qt-dac9c7f42765a46d445aae35fd0e85b402ceb164.tar.bz2
Fix off-by-one at end when views scroll to keep currentItem visible.
endPosition() is the last pixel of the item, i.e. width-1, so must add one to ensure the entire item is visible. Task-number: QTBUG-12822
Diffstat (limited to 'src')
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp12
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp14
2 files changed, 13 insertions, 13 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 37beab5..a0faf14 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -2212,7 +2212,7 @@ void QDeclarativeGridView::trackedPositionChanged()
if (trackedPos < d->startPosition() + d->highlightRangeStart) {
pos = d->startPosition();
} else if (d->trackedItem->endRowPos() > d->endPosition() - d->size() + d->highlightRangeEnd) {
- pos = d->endPosition() - d->size();
+ pos = d->endPosition() - d->size() + 1;
if (pos < d->startPosition())
pos = d->startPosition();
} else {
@@ -2226,14 +2226,14 @@ void QDeclarativeGridView::trackedPositionChanged()
} else {
if (trackedPos < viewPos && d->currentItem->rowPos() < viewPos) {
pos = d->currentItem->rowPos() < trackedPos ? trackedPos : d->currentItem->rowPos();
- } else if (d->trackedItem->endRowPos() > viewPos + d->size()
- && d->currentItem->endRowPos() > viewPos + d->size()) {
- if (d->trackedItem->endRowPos() < d->currentItem->endRowPos()) {
- pos = d->trackedItem->endRowPos() - d->size();
+ } else if (d->trackedItem->endRowPos() >= viewPos + d->size()
+ && d->currentItem->endRowPos() >= viewPos + d->size()) {
+ if (d->trackedItem->endRowPos() <= d->currentItem->endRowPos()) {
+ pos = d->trackedItem->endRowPos() - d->size() + 1;
if (d->rowSize() > d->size())
pos = trackedPos;
} else {
- pos = d->currentItem->endRowPos() - d->size();
+ pos = d->currentItem->endRowPos() - d->size() + 1;
if (d->rowSize() > d->size())
pos = d->currentItem->rowPos();
}
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index f80c73a..d3d46f7 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -2652,7 +2652,7 @@ void QDeclarativeListView::trackedPositionChanged()
if (trackedPos < d->startPosition() + d->highlightRangeStart) {
pos = d->startPosition();
} else if (d->trackedItem->endPosition() > d->endPosition() - d->size() + d->highlightRangeEnd) {
- pos = d->endPosition() - d->size();
+ pos = d->endPosition() - d->size() + 1;
if (pos < d->startPosition())
pos = d->startPosition();
} else {
@@ -2666,14 +2666,14 @@ void QDeclarativeListView::trackedPositionChanged()
} else {
if (trackedPos < viewPos && d->currentItem->position() < viewPos) {
pos = d->currentItem->position() < trackedPos ? trackedPos : d->currentItem->position();
- } else if (d->trackedItem->endPosition() > viewPos + d->size()
- && d->currentItem->endPosition() > viewPos + d->size()) {
- if (d->trackedItem->endPosition() < d->currentItem->endPosition()) {
- pos = d->trackedItem->endPosition() - d->size();
- if (d->trackedItem->size() > d->size())
+ } else if (d->trackedItem->endPosition() >= viewPos + d->size()
+ && d->currentItem->endPosition() >= viewPos + d->size()) {
+ if (d->trackedItem->endPosition() <= d->currentItem->endPosition()) {
+ pos = d->trackedItem->endPosition() - d->size() + 1;
+ if (d->trackedItem->size() > d->size())
pos = trackedPos;
} else {
- pos = d->currentItem->endPosition() - d->size();
+ pos = d->currentItem->endPosition() - d->size() + 1;
if (d->currentItem->size() > d->size())
pos = d->currentItem->position();
}