diff options
| author | Peter Penz <[email protected]> | 2007-08-06 06:56:36 +0000 |
|---|---|---|
| committer | Peter Penz <[email protected]> | 2007-08-06 06:56:36 +0000 |
| commit | 0111d9b0a02098065a32b34c9b04fde72addb626 (patch) | |
| tree | 3b1a90884fcb505d1a9250ba28cf5918a3d2cf74 /src/dolphinview.cpp | |
| parent | 1fbb2359d3370596f2c400f98a4b0af74740848e (diff) | |
Fixed 'Select All' and 'Invert Selection' for the column view (only the items of the currently active column will be selected, not the whole tree). The current implementation is quite slow, but this will be fixed later.
svn path=/trunk/KDE/kdebase/apps/; revision=696893
Diffstat (limited to 'src/dolphinview.cpp')
| -rw-r--r-- | src/dolphinview.cpp | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/src/dolphinview.cpp b/src/dolphinview.cpp index 7fc727475..a9f160d00 100644 --- a/src/dolphinview.cpp +++ b/src/dolphinview.cpp @@ -269,12 +269,27 @@ bool DolphinView::supportsCategorizedSorting() const void DolphinView::selectAll() { - selectAll(QItemSelectionModel::Select); + itemView()->selectAll(); } void DolphinView::invertSelection() { - selectAll(QItemSelectionModel::Toggle); + if (isColumnViewActive()) { + // In opposite to QAbstractItemView::selectAll() there is no virtual method + // for adjusting the invertion of a selection. As the generic approach by using + // the selection model does not work for the column view, we delegate this task: + 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); + + QItemSelection selection(topLeft, bottomRight); + selectionModel->select(selection, QItemSelectionModel::Toggle); + } } bool DolphinView::hasSelection() const @@ -878,19 +893,6 @@ void DolphinView::createView() this, SLOT(emitContentsMoved())); } -void DolphinView::selectAll(QItemSelectionModel::SelectionFlags flags) -{ - 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); - - QItemSelection selection(topLeft, bottomRight); - selectionModel->select(selection, flags); -} - QAbstractItemView* DolphinView::itemView() const { if (m_detailsView != 0) { |
