diff options
author | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-08-11 09:36:48 (GMT) |
---|---|---|
committer | Gabriel de Dietrich <gabriel.dietrich-de@nokia.com> | 2009-08-11 09:51:56 (GMT) |
commit | dadb7b7ad36c43757d96b540b40cc3d81dca69d2 (patch) | |
tree | bba28e1c731d76b0613b8424449b3fa6102959ca /src/gui/itemviews | |
parent | ec82f4fee841cc312a2d3517de36941ad8bee158 (diff) | |
download | Qt-dadb7b7ad36c43757d96b540b40cc3d81dca69d2.zip Qt-dadb7b7ad36c43757d96b540b40cc3d81dca69d2.tar.gz Qt-dadb7b7ad36c43757d96b540b40cc3d81dca69d2.tar.bz2 |
QTableView with swapped headers PageUp/PageDown bug
QTableView with header-swapped rows wouldn't scroll correctly when PageUp or PageDown pressed.
Simplified calculation for next currentIndex provided in QTableView::moveCursor.
Task-number: 259308
Reviewed-by: olivier
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r-- | src/gui/itemviews/qtableview.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index 2009499..8fc99a0 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -1197,17 +1197,16 @@ QModelIndex QTableView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifi visualRow = bottom; break; case MovePageUp: { - int top = 0; - while (top < bottom && d->isVisualRowHiddenOrDisabled(top, visualColumn)) - ++top; - int newRow = qMax(rowAt(visualRect(current).top() - d->viewport->height()), top); - return d->model->index(qBound(0, newRow, bottom), current.column(), d->root); + int newRow = rowAt(visualRect(current).top() - d->viewport->height()); + if (newRow == -1) + newRow = d->logicalRow(0); + return d->model->index(newRow, current.column(), d->root); } case MovePageDown: { - int newRow = qMin(rowAt(visualRect(current).bottom() + d->viewport->height()), bottom); - if (newRow < 0) - newRow = bottom; - return d->model->index(qBound(0, newRow, bottom), current.column(), d->root); + int newRow = rowAt(visualRect(current).bottom() + d->viewport->height()); + if (newRow == -1) + newRow = d->logicalRow(bottom); + return d->model->index(newRow, current.column(), d->root); }} int logicalRow = d->logicalRow(visualRow); |