diff options
| author | Frank Reininghaus <[email protected]> | 2009-07-14 20:47:37 +0000 |
|---|---|---|
| committer | Frank Reininghaus <[email protected]> | 2009-07-14 20:47:37 +0000 |
| commit | 027bfb1789cfc47545b708e6fe1d4391c2319f68 (patch) | |
| tree | 549756392b70324f08e41e15f829bddbdf80e326 /src | |
| parent | 32157cc47c270221c2003206e7793d0fc9bf2f16 (diff) | |
Improve selection behaviour concerning the new "jump to next/previous
row using right/left arrow" and "jump to next/previous column using
down/up arrow" when using the Icon View's "Rows" and "Columns"
arrangement, respectively, in the following cases:
1. In "Columns" arrangement, if the first item is selected and
Ctrl-Down is pressed repeatedly, don't deselect the first item when
jumping to the next column.
2. In "Rows" arrangement, if the first item in the second row is
active and then Left and finally Shift-Left is pressed, don't
re-select the first item in the second row unexpectedly.
3. If an item in the middle of the second row is selected, make sure
that selection with Shift-Left/Shift-Right is reversible even if the
previous/next row is reached.
svn path=/trunk/KDE/kdebase/apps/; revision=996758
Diffstat (limited to 'src')
| -rw-r--r-- | src/dolphiniconsview.cpp | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/src/dolphiniconsview.cpp b/src/dolphiniconsview.cpp index 55d70a0a2..c6b4f5acf 100644 --- a/src/dolphiniconsview.cpp +++ b/src/dolphiniconsview.cpp @@ -247,10 +247,10 @@ void DolphinIconsView::dropEvent(QDropEvent* event) QModelIndex DolphinIconsView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers) { - QModelIndex current = currentIndex(); + const QModelIndex oldCurrent = currentIndex(); QModelIndex newCurrent = QListView::moveCursor(cursorAction, modifiers); - if (newCurrent != current) { + if (newCurrent != oldCurrent) { return newCurrent; } @@ -274,7 +274,7 @@ QModelIndex DolphinIconsView::moveCursor(CursorAction cursorAction, Qt::Keyboard return newCurrent; } newCurrent = QListView::moveCursor(MovePageUp, modifiers); - selectionModel()->setCurrentIndex(newCurrent, QItemSelectionModel::Clear); + selectionModel()->setCurrentIndex(newCurrent, QItemSelectionModel::NoUpdate); newCurrent = QListView::moveCursor(MoveRight, modifiers); break; @@ -282,6 +282,7 @@ QModelIndex DolphinIconsView::moveCursor(CursorAction cursorAction, Qt::Keyboard break; } } else { + QModelIndex current = oldCurrent; switch (cursorAction) { case MoveLeft: if (newCurrent.row() == 0) { @@ -293,15 +294,6 @@ QModelIndex DolphinIconsView::moveCursor(CursorAction cursorAction, Qt::Keyboard current = newCurrent; newCurrent = QListView::moveCursor(MoveRight, modifiers); } while (newCurrent != current); - - if (!(modifiers & Qt::ControlModifier)) { - // Ctrl is not pressed -> selection is updated - if (!(modifiers & Qt::ShiftModifier)) { - // Shift is not pressed -> previous selection is lost - selectionModel()->clearSelection(); - } - selectionModel()->setCurrentIndex(newCurrent, QItemSelectionModel::Select); - } break; case MoveRight: @@ -321,6 +313,8 @@ QModelIndex DolphinIconsView::moveCursor(CursorAction cursorAction, Qt::Keyboard } } + // Revert all changes of the current item to make sure that item selection works correctly + selectionModel()->setCurrentIndex(oldCurrent, QItemSelectionModel::NoUpdate); return newCurrent; } |
