From 5c5590846d51a0c04a4f3d76dc1bb9ceb6cea497 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20Fern=C3=A1ndez=20L=C3=B3pez?= Date: Fri, 13 Jul 2007 12:25:50 +0000 Subject: [PATCH] Select elements correctly when clicking on the category for selecting. svn path=/trunk/KDE/kdebase/apps/; revision=687361 --- src/kcategorizedview.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/kcategorizedview.cpp b/src/kcategorizedview.cpp index 39e2e4b3f9..133fe5d39c 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);