diff options
| author | Felix Ernst <[email protected]> | 2022-04-04 14:42:02 +0200 |
|---|---|---|
| committer | Felix Ernst <[email protected]> | 2022-04-04 14:42:02 +0200 |
| commit | 86df5ae994e96483559020befd96b838aee4d3ee (patch) | |
| tree | d6c2c349321d859d350f2997a9a840c92fe639c6 /src/kitemviews | |
| parent | fc965a725cd0cfdca520b1a08e1f144f06aab7d2 (diff) | |
| parent | 2de8f4c0fb2141f68400327a4f87eefa71d81e3c (diff) | |
Merge branch 'release/22.04'
Diffstat (limited to 'src/kitemviews')
| -rw-r--r-- | src/kitemviews/kitemlistcontroller.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp index 02b0ccfeb..ba4047dbe 100644 --- a/src/kitemviews/kitemlistcontroller.cpp +++ b/src/kitemviews/kitemlistcontroller.cpp @@ -1601,9 +1601,20 @@ bool KItemListController::onPress(const QPoint& screenPos, const QPointF& pos, c case MultiSelection: if (controlPressed && !shiftPressed) { - m_selectionManager->setSelected(m_pressedIndex.value(), 1, KItemListSelectionManager::Toggle); - m_selectionManager->beginAnchoredSelection(m_pressedIndex.value()); - createRubberBand = false; // multi selection, don't propagate any further + // A mouse button press is happening on an item while control is pressed. This either means a user wants to: + // - toggle the selection of item(s) or + // - they want to begin a drag on the item(s) to copy them. + // We rule out the latter, if the item is not clicked directly and was unselected previously. + const auto row = m_view->m_visibleItems.value(m_pressedIndex.value()); + const auto mappedPos = row->mapFromItem(m_view, pos); + if (!row->iconRect().contains(mappedPos) && !row->textRect().contains(mappedPos) && !pressedItemAlreadySelected) { + createRubberBand = true; + } else { + m_selectionManager->setSelected(m_pressedIndex.value(), 1, KItemListSelectionManager::Toggle); + m_selectionManager->beginAnchoredSelection(m_pressedIndex.value()); + createRubberBand = false; // multi selection, don't propagate any further + // This will be the start of an item drag-to-copy operation if the user now moves the mouse before releasing the mouse button. + } } else if (!shiftPressed || !m_selectionManager->isAnchoredSelectionActive()) { // Select the pressed item and start a new anchored selection m_selectionManager->setSelected(m_pressedIndex.value(), 1, KItemListSelectionManager::Select); |
