From: Rafael Fernández López Date: Fri, 13 Jul 2007 12:25:50 +0000 (+0000) Subject: Select elements correctly when clicking on the category for selecting. X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/5c5590846d51a0c04a4f3d76dc1bb9ceb6cea497?ds=inline Select elements correctly when clicking on the category for selecting. svn path=/trunk/KDE/kdebase/apps/; revision=687361 --- diff --git a/src/kcategorizedview.cpp b/src/kcategorizedview.cpp index 39e2e4b3f..133fe5d39 100644 --- a/src/kcategorizedview.cpp +++ b/src/kcategorizedview.cpp @@ -691,7 +691,7 @@ void KCategorizedView::resizeEvent(QResizeEvent *event) } void KCategorizedView::setSelection(const QRect &rect, - QItemSelectionModel::SelectionFlags flags) + QItemSelectionModel::SelectionFlags flags) { if ((viewMode() != KCategorizedView::IconMode) || !d->proxyModel || !d->itemCategorizer) @@ -865,10 +865,10 @@ void KCategorizedView::mouseReleaseEvent(QMouseEvent *event) { if (d->categoryVisualRect(category).contains(event->pos())) { - QItemSelectionRange selectionRange(d->proxyModel->mapFromSource(d->categoriesIndexes[category][0]), - d->proxyModel->mapFromSource(d->categoriesIndexes[category][d->categoriesIndexes[category].count() - 1])); - - selection << selectionRange; + foreach (const QModelIndex &index, d->categoriesIndexes[category]) + { + selection << QItemSelectionRange(d->proxyModel->mapFromSource(index)); + } selectionModel()->select(selection, QItemSelectionModel::Select);