From 3f612a31a0caa63ea2c40f9ae78167049d43ba6b Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Thu, 18 Aug 2022 18:26:05 -0600 Subject: [PATCH] Only accept press-and-hold to enter Edit Mode, not click-and-hold Press-and-hold is fairly common on touch UIs, but click-and-hold is a very rare interaction. As a result, the user is much more likely to enter Edit Mode accidentally while trying to drag something on the desktop than they are to know that click-and-hold works here and do it intentionally. Let's disable click-and-hold and only enter Edit Mode with a press-and-hold using a touch device. For pointing device users, there are already multiple context menus items that will let them enter Edit Mode. BUG: 457979 FIXED-IN: 5.26 --- components/containmentlayoutmanager/appletslayout.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/components/containmentlayoutmanager/appletslayout.cpp b/components/containmentlayoutmanager/appletslayout.cpp index 4ae05b8f8..e31606f49 100644 --- a/components/containmentlayoutmanager/appletslayout.cpp +++ b/components/containmentlayoutmanager/appletslayout.cpp @@ -597,6 +597,12 @@ void AppletsLayout::mousePressEvent(QMouseEvent *event) { forceActiveFocus(Qt::MouseFocusReason); + // Only accept synthesized events i.e. touch events, because we only want + // to support press-and-hold. Click-and-hold is weird. See 457979. + if (!(event->source() == Qt::MouseEventSynthesizedBySystem || event->source() == Qt::MouseEventSynthesizedByQt)) { + return; + } + if (!m_editMode && m_editModeCondition == AppletsLayout::Manual) { return; }