[system/dolphin] src/kitemviews: kitemviews: Leave the selection alone when the middle button is pressed
Méven Car <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit e2b66833adf91ab984a3d1e74ae86fb26b28b0ce by Méven Car.
Committed on 28/07/2026 at 08:22.
Pushed by meven into branch 'master'.
kitemviews: Leave the selection alone when the middle button is pressed
Holding the middle button down and dragging drew a rubber band and selected
whatever it covered, and a middle press on its own cleared the selection. The
middle button opens an item in a new tab, so it has nothing to say about what
is selected.
onPress answers for the left, right, back and forward buttons and fell through
for the middle one. Its caller reads that as nobody having claimed the press
and starts a rubber band, which is where the selection box came from. Answer
for the middle button too, next to the back and forward buttons that are
turned down for the same reason.
Opening in a new tab is untouched. That happens on release, from the item the
release position points at.
M +6 -0 src/kitemviews/kitemlistcontroller.cpp
https://invent.kde.org/system/dolphin/-/commit/e2b66833adf91ab984a3d1e74ae86fb26b28b0ce
diff --git a/src/kitemviews/kitemlistcontroller.cpp b/src/kitemviews/kitemlistcontroller.cpp
index 3c450b65fa..0ff04036ec 100644
--- a/src/kitemviews/kitemlistcontroller.cpp
+++ b/src/kitemviews/kitemlistcontroller.cpp
@@ -1643,6 +1643,12 @@ bool KItemListController::onPress(const QPointF &pos, const Qt::KeyboardModifier
return true;
}
+ if (buttons & Qt::MiddleButton) {
+ // The middle button opens an item in a new tab on release and leaves the selection
+ // alone, so there is nothing to select here and no rubber band to draw.
+ return true;
+ }
+
const QPointF pressedMousePos = m_view->transform().map(pos);
if (m_view->isAboveExpansionToggle(m_pressedIndex.value_or(-1), pressedMousePos)) {