Commit eb4b0fb4 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇
Browse files

Emit "itemMiddleClicked" when Ctrl-clicking a view in single selection mode

When Ctrl can't cause a change in selection, so instead emit `itemMiddleClicked`.
This way one can Ctrl-click a Place or folder in Folders panel to open it in
a new tab, similar to what web browsers.
parent 6dd67f6f
Pipeline #47152 passed with stage
in 7 minutes and 16 seconds
......@@ -1550,8 +1550,9 @@ bool KItemListController::onRelease(const QPointF& pos, const Qt::KeyboardModifi
return true;
}
const bool controlPressed = modifiers & Qt::ControlModifier;
const bool shiftOrControlPressed = modifiers & Qt::ShiftModifier ||
modifiers & Qt::ControlModifier;
controlPressed;
KItemListRubberBand* rubberBand = m_view->rubberBand();
if (rubberBand->isActive()) {
......@@ -1585,6 +1586,11 @@ bool KItemListController::onRelease(const QPointF& pos, const Qt::KeyboardModifi
} else if (shiftOrControlPressed) {
// The mouse click should only update the selection, not trigger the item
emitItemActivated = false;
// When Ctrl-clicking an item when in single selection mode
// i.e. where Ctrl won't change the selection, pretend it was middle clicked
if (controlPressed && m_selectionBehavior == SingleSelection) {
Q_EMIT itemMiddleClicked(index);
}
} else if (!(m_view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) || m_singleClickActivationEnforced)) {
if (touch) {
emitItemActivated = true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment