diff options
| author | Tranter Madi <[email protected]> | 2019-06-04 15:49:39 +0700 |
|---|---|---|
| committer | Tranter Madi <[email protected]> | 2019-06-05 16:40:54 +0700 |
| commit | 038565b62f6ca6323cae2c5a23a97d66fc3dc0cd (patch) | |
| tree | e87b80288e6f02dae32912709d0bb9a98c65c94c /src | |
| parent | 0bc919bd4758a84ccc0928ff784223984ec5df88 (diff) | |
Scroll when pressing PageUp/PageDown
Summary:
Add `PageUp/PageDown` to the `navigationPressed` variable.
Remove the `m_view->firstVisibleIndex()` and `m_view->lastVisibleIndex()` tests because sometimes it does not work correctly.
BUG: 407118
Test Plan:
Press PageUp/PageDOwn: it scrolls
Press Up/DOwn: it always scrolls
Reviewers: #dolphin, Zren, cfeck, elvisangelaccio
Reviewed By: #dolphin, elvisangelaccio
Subscribers: elvisangelaccio, kfm-devel
Tags: #dolphin
Differential Revision: https://phabricator.kde.org/D21573
Diffstat (limited to 'src')
| -rw-r--r-- | src/kitemviews/kitemlistcontroller.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index 6fb6a5132..4bfd5b4cb 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -232,7 +232,8 @@ bool KItemListController::keyPressEvent(QKeyEvent* event) const bool controlPressed = event->modifiers() & Qt::ControlModifier; const bool shiftOrControlPressed = shiftPressed || controlPressed; const bool navigationPressed = key == Qt::Key_Home || key == Qt::Key_End || - key == Qt::Key_Up || key == Qt::Key_Down || + key == Qt::Key_PageUp || key == Qt::Key_PageDown || + key == Qt::Key_Up || key == Qt::Key_Down || key == Qt::Key_Left || key == Qt::Key_Right; const int itemCount = m_model->count(); @@ -461,9 +462,7 @@ bool KItemListController::keyPressEvent(QKeyEvent* event) } if (navigationPressed) { - if (index < m_view->firstVisibleIndex() || index > m_view->lastVisibleIndex()) { - m_view->scrollToItem(index); - } + m_view->scrollToItem(index); } return true; } |
