diff options
| author | Rafael Fernández López <[email protected]> | 2007-12-12 00:04:13 +0000 |
|---|---|---|
| committer | Rafael Fernández López <[email protected]> | 2007-12-12 00:04:13 +0000 |
| commit | d351d41e4bfd982646d7919b7eeb2cf98992edc3 (patch) | |
| tree | 3da3c71468776dfd3c1d194745ed660f07a32899 /src | |
| parent | 1ab719d490d467218d65f2b03b3ec0ec717515b5 (diff) | |
Fixes the problem with the keyboard navigation when a selection with the right-click or a dragging unitary selection was done.
BUG: 153875
svn path=/trunk/KDE/kdebase/apps/; revision=747421
Diffstat (limited to 'src')
| -rw-r--r-- | src/kcategorizedview.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/kcategorizedview.cpp b/src/kcategorizedview.cpp index c062b12b3..72936113c 100644 --- a/src/kcategorizedview.cpp +++ b/src/kcategorizedview.cpp @@ -870,12 +870,29 @@ void KCategorizedView::setSelection(const QRect &rect, return; } + int viewportWidth = viewport()->width() - spacing(); + int itemWidth; + + if (gridSize().isEmpty()) + { + itemWidth = d->biggestItemSize.width(); + } + else + { + itemWidth = gridSize().width(); + } + + int itemWidthPlusSeparation = spacing() + itemWidth; + int elementsPerRow = viewportWidth / itemWidthPlusSeparation; + QItemSelection selection; if (!d->mouseButtonPressed) { selection = QItemSelection(dirtyIndexes[0], dirtyIndexes[0]); d->currentViewIndex = dirtyIndexes[0]; + selectionModel()->setCurrentIndex(d->currentViewIndex, flags); + d->forcedSelectionPosition = d->elementsInfo[d->currentViewIndex.row()].relativeOffsetToCategory % elementsPerRow; } else { @@ -897,6 +914,12 @@ void KCategorizedView::setSelection(const QRect &rect, if (last.isValid()) selection << QItemSelectionRange(first, last); + + if (first == last) + { + selectionModel()->setCurrentIndex(first, QItemSelectionModel::SelectCurrent); + d->forcedSelectionPosition = d->elementsInfo[first.row()].relativeOffsetToCategory % elementsPerRow; + } } if (d->lastSelection.count()) |
