X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/blobdiff_plain/a24c1fce8234dc0ad0116aecc06c7151bcdd1cee..b5eca6dc2aaa6f90d7dc2fe27ab9ccc45aee77f2:/src/kcategorizedview.cpp diff --git a/src/kcategorizedview.cpp b/src/kcategorizedview.cpp index 7fe806055..ec5ba36b7 100644 --- a/src/kcategorizedview.cpp +++ b/src/kcategorizedview.cpp @@ -980,8 +980,8 @@ void KCategorizedView::startDrag(Qt::DropActions supportedActions) // pixmap of selected icons to the dragging cursor, but it sets a non // ARGB window so it is no transparent. Use QAbstractItemView when // this is fixed on Qt. - //QListView::startDrag(supportedActions); - QAbstractItemView::startDrag(supportedActions); + // QAbstractItemView::startDrag(supportedActions); + QListView::startDrag(supportedActions); d->isDragging = false; d->mouseButtonPressed = false; @@ -1022,7 +1022,7 @@ void KCategorizedView::dragLeaveEvent(QDragLeaveEvent *event) } QModelIndex KCategorizedView::moveCursor(CursorAction cursorAction, - Qt::KeyboardModifiers modifiers) + Qt::KeyboardModifiers modifiers) { if ((viewMode() != KCategorizedView::IconMode) || !d->proxyModel || @@ -1133,6 +1133,16 @@ QModelIndex KCategorizedView::moveCursor(CursorAction cursorAction, } case QAbstractItemView::MoveLeft: + if (layoutDirection() == Qt::RightToLeft) + { + d->forcedSelectionPosition = d->elementsInfo[current.row() + 1].relativeOffsetToCategory % elementsPerRow; + + if (d->forcedSelectionPosition < 0) + d->forcedSelectionPosition = (d->categoriesIndexes[theCategory].count() - 1) % elementsPerRow; + + return d->proxyModel->index(current.row() + 1, 0); + } + d->forcedSelectionPosition = d->elementsInfo[current.row() - 1].relativeOffsetToCategory % elementsPerRow; if (d->forcedSelectionPosition < 0) @@ -1141,6 +1151,16 @@ QModelIndex KCategorizedView::moveCursor(CursorAction cursorAction, return d->proxyModel->index(current.row() - 1, 0); case QAbstractItemView::MoveRight: + if (layoutDirection() == Qt::RightToLeft) + { + d->forcedSelectionPosition = d->elementsInfo[current.row() - 1].relativeOffsetToCategory % elementsPerRow; + + if (d->forcedSelectionPosition < 0) + d->forcedSelectionPosition = (d->categoriesIndexes[theCategory].count() - 1) % elementsPerRow; + + return d->proxyModel->index(current.row() - 1, 0); + } + d->forcedSelectionPosition = d->elementsInfo[current.row() + 1].relativeOffsetToCategory % elementsPerRow; if (d->forcedSelectionPosition < 0)