From d1c5ed964eeca8f9d48f3819a67780c01cf6c080 Mon Sep 17 00:00:00 2001 From: yeshanshan Date: Fri, 6 Mar 2026 17:41:44 +0800 Subject: [PATCH] fix: correct touchscreen right-click menu interaction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changed the right-click menu trigger from onTapped to onPressedChanged in two TapHandler instances within NotifyViewDelegate.qml. The previous implementation using onTapped caused incorrect behavior on touchscreen devices where the right-click menu would appear and immediately disappear. The new implementation triggers the menu when the button is pressed (pressed becomes true) rather than when the tap is completed, ensuring proper menu display on touchscreen devices. Log: Fixed touchscreen right-click menu interaction issue where menus would not stay open Influence: 1. Test right-click menu behavior on touchscreen devices 2. Verify menu appears and remains visible when right-clicking notifications 3. Test that menu functionality remains unchanged for mouse users 4. Verify menu positioning is correct relative to the touch point 5. Test interaction with different notification types in the notification center fix: 修正触摸屏右键菜单交互问题 将 NotifyViewDelegate.qml 中两个 TapHandler 实例的右键菜单触发方式从 onTapped 改为 onPressedChanged。之前的实现使用 onTapped 会导致在触摸屏设 备上右键菜单出现后立即消失的问题。新的实现方式在按钮按下时(pressed 变为 true)触发菜单显示,而不是在点击完成时触发,确保在触摸屏设备上菜单能正确 显示。 Log: 修复触摸屏右键菜单交互问题,解决菜单无法保持打开状态的问题 Influence: 1. 在触摸屏设备上测试右键菜单行为 2. 验证右键点击通知时菜单出现并保持可见 3. 测试鼠标用户的菜单功能是否保持不变 4. 验证菜单位置相对于触摸点的定位是否正确 5. 测试通知中心中不同类型通知的交互 PMS: BUG-352017 --- .../notification/center/NotifyViewDelegate.qml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/panels/notification/center/NotifyViewDelegate.qml b/panels/notification/center/NotifyViewDelegate.qml index f2ed3a970..a97db3326 100644 --- a/panels/notification/center/NotifyViewDelegate.qml +++ b/panels/notification/center/NotifyViewDelegate.qml @@ -113,9 +113,11 @@ DelegateChooser { TapHandler { acceptedButtons: Qt.RightButton - onTapped: function (eventPoint, button) { - let pos = eventPoint.position - setting(pos) + onPressedChanged: function () { + if (pressed) { + let pos = point.position + setting(pos) + } } } @@ -201,9 +203,11 @@ DelegateChooser { TapHandler { acceptedButtons: Qt.RightButton - onTapped: function (eventPoint, button) { - let pos = eventPoint.position - setting(pos) + onPressedChanged: function () { + if (pressed) { + let pos = point.position + setting(pos) + } } }