mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-19 08:21:22 +00:00
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
This commit is contained in:
parent
1ab719d490
commit
d351d41e4b
|
@ -870,12 +870,29 @@ void KCategorizedView::setSelection(const QRect &rect,
|
||||||
return;
|
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;
|
QItemSelection selection;
|
||||||
|
|
||||||
if (!d->mouseButtonPressed)
|
if (!d->mouseButtonPressed)
|
||||||
{
|
{
|
||||||
selection = QItemSelection(dirtyIndexes[0], dirtyIndexes[0]);
|
selection = QItemSelection(dirtyIndexes[0], dirtyIndexes[0]);
|
||||||
d->currentViewIndex = dirtyIndexes[0];
|
d->currentViewIndex = dirtyIndexes[0];
|
||||||
|
selectionModel()->setCurrentIndex(d->currentViewIndex, flags);
|
||||||
|
d->forcedSelectionPosition = d->elementsInfo[d->currentViewIndex.row()].relativeOffsetToCategory % elementsPerRow;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -897,6 +914,12 @@ void KCategorizedView::setSelection(const QRect &rect,
|
||||||
|
|
||||||
if (last.isValid())
|
if (last.isValid())
|
||||||
selection << QItemSelectionRange(first, last);
|
selection << QItemSelectionRange(first, last);
|
||||||
|
|
||||||
|
if (first == last)
|
||||||
|
{
|
||||||
|
selectionModel()->setCurrentIndex(first, QItemSelectionModel::SelectCurrent);
|
||||||
|
d->forcedSelectionPosition = d->elementsInfo[first.row()].relativeOffsetToCategory % elementsPerRow;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (d->lastSelection.count())
|
if (d->lastSelection.count())
|
||||||
|
|
Loading…
Reference in a new issue