From 41f8286a568f01bc2723eb74e763556b4c397546 Mon Sep 17 00:00:00 2001 From: Peter Penz Date: Tue, 25 Sep 2007 13:53:08 +0000 Subject: assure that "Select All" and "Invert Selection" only operate on the active column of the column-view instead of selecting the whole hierarchy of the model svn path=/trunk/KDE/kdebase/apps/; revision=716885 --- src/dolphinview.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/dolphinview.cpp') diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index dc8c8dd87..a85e2db9b 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -252,15 +252,24 @@ void DolphinView::selectAll() void DolphinView::invertSelection() { - QItemSelectionModel* selectionModel = itemView()->selectionModel(); - const QAbstractItemModel* itemModel = selectionModel->model(); + if (isColumnViewActive()) { + // QAbstractItemView does not offer a virtual method invertSelection() + // as counterpart to QAbstractItemView::selectAll(). This makes it + // necessary to delegate the inverting of the selection to the + // column view, as only the selection of the active column should get + // inverted. + m_columnView->invertSelection(); + } else { + QItemSelectionModel* selectionModel = itemView()->selectionModel(); + const QAbstractItemModel* itemModel = selectionModel->model(); - const QModelIndex topLeft = itemModel->index(0, 0); - const QModelIndex bottomRight = itemModel->index(itemModel->rowCount() - 1, - itemModel->columnCount() - 1); + const QModelIndex topLeft = itemModel->index(0, 0); + const QModelIndex bottomRight = itemModel->index(itemModel->rowCount() - 1, + itemModel->columnCount() - 1); - QItemSelection selection(topLeft, bottomRight); - selectionModel->select(selection, QItemSelectionModel::Toggle); + const QItemSelection selection(topLeft, bottomRight); + selectionModel->select(selection, QItemSelectionModel::Toggle); + } } bool DolphinView::hasSelection() const -- cgit v1.3