From: Frank Reininghaus Date: Sun, 28 Aug 2011 17:16:14 +0000 (+0200) Subject: Control-rubberband selection toggles the selection state X-Git-Url: https://cloud.milkyroute.net/gitweb/dolphin.git/commitdiff_plain/b01c73607be9974032a15a4b8ab39d5379991cb6 Control-rubberband selection toggles the selection state --- diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index 5eae95e6d..c0875ce39 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -678,7 +678,16 @@ void KItemListController::slotRubberBandChanged() } } while (!selectionFinished); - m_selectionManager->setSelectedItems(selectedItems + m_oldSelection); + if (QApplication::keyboardModifiers() & Qt::ControlModifier) { + // If Control is pressed, the selection state of all items in the rubberband is toggled. + // Therefore, the new selection contains: + // 1. All previously selected items which are not inside the rubberband, and + // 2. all items inside the rubberband which have not been selected previously. + m_selectionManager->setSelectedItems((m_oldSelection - selectedItems) + (selectedItems - m_oldSelection)); + } + else { + m_selectionManager->setSelectedItems(selectedItems + m_oldSelection); + } } bool KItemListController::startDragging()