m_longPressDetectionTimer->setInterval(QGuiApplication::styleHints()->mousePressAndHoldInterval());
connect(m_longPressDetectionTimer, &QTimer::timeout, this, [this]() {
if (!m_selectionMode) {
- Q_EMIT selectionModeRequested();
+ Q_EMIT selectionModeChangeRequested(true);
}
});
return m_singleClickActivationEnforced;
}
-void KItemListController::setSelectionMode(bool enabled)
+void KItemListController::setSelectionModeEnabled(bool enabled)
{
m_selectionMode = enabled;
}
}
case Qt::Key_Escape:
- if (m_selectionBehavior != SingleSelection) {
+ if (m_selectionMode) {
+ Q_EMIT selectionModeChangeRequested(false);
+ } else if (m_selectionBehavior != SingleSelection) {
m_selectionManager->clearSelection();
}
m_keyboardManager->cancelSearch();
}
const bool shiftPressed = modifiers & Qt::ShiftModifier;
- const bool controlPressed = (modifiers & Qt::ControlModifier) || m_selectionMode;
+ const bool controlPressed = (modifiers & Qt::ControlModifier) || m_selectionMode; // Keeping selectionMode similar to pressing control will hopefully
+ // simplify the overall logic and possibilities both for users and devs.
const bool leftClick = buttons & Qt::LeftButton;
const bool rightClick = buttons & Qt::RightButton;
} else {
const bool singleClickActivation = m_view->style()->styleHint(QStyle::SH_ItemView_ActivateItemOnSingleClick) || m_singleClickActivationEnforced;
if (!singleClickActivation) {
- emitItemActivated = touch;
+ emitItemActivated = touch && !m_selectionMode;
} else {
// activate on single click only if we didn't come from a rubber band release
emitItemActivated = !rubberBandRelease;