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
QModelIndex DolphinIconsView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers)
{
QModelIndex DolphinIconsView::moveCursor(CursorAction cursorAction, Qt::KeyboardModifiers modifiers)
{
- QModelIndex current = currentIndex();
+ const QModelIndex oldCurrent = currentIndex();
QModelIndex newCurrent = QListView::moveCursor(cursorAction, modifiers);
QModelIndex newCurrent = QListView::moveCursor(cursorAction, modifiers);
- if (newCurrent != current) {
+ if (newCurrent != oldCurrent) {
return newCurrent;
}
newCurrent = QListView::moveCursor(MovePageUp, modifiers);
return newCurrent;
}
newCurrent = QListView::moveCursor(MovePageUp, modifiers);
- selectionModel()->setCurrentIndex(newCurrent, QItemSelectionModel::Clear);
+ selectionModel()->setCurrentIndex(newCurrent, QItemSelectionModel::NoUpdate);
newCurrent = QListView::moveCursor(MoveRight, modifiers);
break;
newCurrent = QListView::moveCursor(MoveRight, modifiers);
break;
+ QModelIndex current = oldCurrent;
switch (cursorAction) {
case MoveLeft:
if (newCurrent.row() == 0) {
switch (cursorAction) {
case MoveLeft:
if (newCurrent.row() == 0) {
current = newCurrent;
newCurrent = QListView::moveCursor(MoveRight, modifiers);
} while (newCurrent != current);
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);
- }
+ // Revert all changes of the current item to make sure that item selection works correctly
+ selectionModel()->setCurrentIndex(oldCurrent, QItemSelectionModel::NoUpdate);