From d07fd7c4d828d44376ba36d2c3496ebc7115c028 Mon Sep 17 00:00:00 2001 From: fuleyi Date: Tue, 19 May 2026 16:40:27 +0800 Subject: [PATCH] fix: disable context menu trigger on multitask view MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Replace the previous MouseArea click handling with TapHandler-based input processing in the multitask view dock item 2. Handle mouse input explicitly by accepting left and right buttons, but only execute Applet.openWorkspace() on left-button taps 3. Add a dedicated touch-screen TapHandler that accepts touch input and opens the workspace on tap 4. Keep gesture handling within bounds to avoid unintended activation outside the item area 5. This change prevents right-click mouse actions and long-press touch interactions from triggering behavior that could lead to an unnecessary context menu, while preserving normal left-click and touch- tap activation Log: Adjusted multitask view interaction so right-click and touch long- press no longer bring up the context menu Influence: 1. Verify left-click on the multitask view item still opens the workspace and closes the tooltip 2. Verify right-click on the multitask view item does not open the workspace and does not show an unwanted context menu 3. Verify single tap on a touch screen still opens the workspace correctly 4. Verify long-press on a touch screen does not trigger a context menu or other unintended action 5. Verify hover behavior and tooltip display remain unchanged 6. Verify taps or clicks outside the item bounds do not trigger workspace activation fix: 禁止多任务视图触发右键菜单 1. 将多任务视图停靠项中原有的 MouseArea 点击处理替换为基于 TapHandler 的 输入处理 2. 显式处理鼠标输入,接受左键和右键事件,但仅在左键点击时执行 Applet.openWorkspace() 3. 新增一个专用于触摸屏的 TapHandler,用于接收触控输入并在点击时打开工 作区 4. 将手势处理限制在组件边界内,避免在项目区域外发生误触发 5. 此修改可避免鼠标右键操作和触摸屏长按交互触发可能导致不必要右键菜单的 行为,同时保留正常的左键点击和触控点击激活能力 Log: 调整多任务视图交互,右键和触摸长按不再弹出右键菜单 Influence: 1. 验证左键点击多任务视图项后,仍可正常打开工作区并关闭提示框 2. 验证右键点击多任务视图项时,不会打开工作区,也不会弹出不需要的右键 菜单 3. 验证在触摸屏上单击后,仍可正常打开工作区 4. 验证在触摸屏上长按时,不会触发右键菜单或其他非预期行为 5. 验证悬停行为和提示框显示逻辑保持不变 6. 验证在组件边界外的点击或触控不会触发工作区打开 PMS: BUG-358827 Change-Id: Idb15959f60b67a8506ba8a62ce309c0237c86e69 --- .../multitaskview/package/multitaskview.qml | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/panels/dock/multitaskview/package/multitaskview.qml b/panels/dock/multitaskview/package/multitaskview.qml index cbd081f22..71bf95165 100644 --- a/panels/dock/multitaskview/package/multitaskview.qml +++ b/panels/dock/multitaskview/package/multitaskview.qml @@ -39,16 +39,27 @@ AppletDockItem { } } - MouseArea { - id: mouseHandler - anchors.fill: parent - onClicked: function (mouse) { - if (mouse.button === Qt.LeftButton) { + TapHandler { + id: tapHandler + acceptedButtons: Qt.LeftButton | Qt.RightButton + gesturePolicy: TapHandler.WithinBounds + onTapped: function (eventPoint, buttons) { + if (buttons === Qt.LeftButton) { Applet.openWorkspace() toolTip.close() } } } + + TapHandler { + acceptedButtons: Qt.NoButton + acceptedDevices: PointerDevice.TouchScreen + gesturePolicy: TapHandler.WithinBounds + onTapped: function (eventPoint, buttons) { + Applet.openWorkspace() + toolTip.close() + } + } HoverHandler { onHoveredChanged: { if (hovered) {