diff options
author | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-11-17 17:31:32 (GMT) |
---|---|---|
committer | Leonardo Sobral Cunha <leo.cunha@nokia.com> | 2009-11-18 14:19:59 (GMT) |
commit | e15accd154c40bcf26dcb5209431974ad2617a73 (patch) | |
tree | 9e2d29d8a191a37e1748deeb46388b52718f676f /src/gui/itemviews | |
parent | b099c4c07f3747fefff3d7457b4ae817225ca9ae (diff) | |
download | Qt-e15accd154c40bcf26dcb5209431974ad2617a73.zip Qt-e15accd154c40bcf26dcb5209431974ad2617a73.tar.gz Qt-e15accd154c40bcf26dcb5209431974ad2617a73.tar.bz2 |
QListView: fixes skipping one item in pageDown(Up)
The previous implementation was scrolling down (number of visible items
in viewport) + 1 and this was leading to one item being skipped while doing
page down (the same also happened for page up). Now we are scrolling (number
of visible items in viewport) - 1 for each page down(up) (the '-1' is for
keeping the context, so the last item will turn into the first in case of
a page down, for example).
Task-number: QTBUG-5877
Reviewed-by: thierry
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r-- | src/gui/itemviews/qlistview.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gui/itemviews/qlistview.cpp b/src/gui/itemviews/qlistview.cpp index 31e5797..052308c 100644 --- a/src/gui/itemviews/qlistview.cpp +++ b/src/gui/itemviews/qlistview.cpp @@ -1147,7 +1147,9 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie } return d->closestIndex(initialRect, intersectVector); case MovePageUp: - rect.moveTop(rect.top() - d->viewport->height()); + // move current by (visibileRowCount - 1) items. + // rect.translate(0, -rect.height()); will happen in the switch fallthrough for MoveUp. + rect.moveTop(rect.top() - d->viewport->height() + 2 * rect.height()); if (rect.top() < rect.height()) rect.moveTop(rect.height()); case MovePrevious: @@ -1173,7 +1175,9 @@ QModelIndex QListView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifie } return d->closestIndex(initialRect, intersectVector); case MovePageDown: - rect.moveTop(rect.top() + d->viewport->height()); + // move current by (visibileRowCount - 1) items. + // rect.translate(0, rect.height()); will happen in the switch fallthrough for MoveDown. + rect.moveTop(rect.top() + d->viewport->height() - 2 * rect.height()); if (rect.bottom() > contents.height() - rect.height()) rect.moveBottom(contents.height() - rect.height()); case MoveNext: |