fix: enable right-click menu via long-press on touchscreen#1579
fix: enable right-click menu via long-press on touchscreen#1579wjyrich wants to merge 1 commit intolinuxdeepin:masterfrom
Conversation
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: wjyrich The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Reviewer's guide (collapsed on small PRs)Reviewer's GuideExtends the AppItem long-press handler so that both pure touch long-presses and right-button long-presses on touchscreens open the taskbar app item's context menu, without changing normal left-click or desktop right-click behavior. Sequence diagram for AppItem long-press handling on touchscreensequenceDiagram
actor TouchUser
participant AppItem
participant ContextMenu
TouchUser->>AppItem: pressAndHold (touch, Qt.NoButton)
AppItem->>AppItem: onPressAndHold(mouse)
AppItem->>AppItem: if mouse.button == Qt.NoButton or Qt.RightButton
AppItem->>ContextMenu: requestAppItemMenu()
TouchUser->>AppItem: pressAndHold (right-click hardware, Qt.RightButton)
AppItem->>AppItem: onPressAndHold(mouse)
AppItem->>AppItem: if mouse.button == Qt.NoButton or Qt.RightButton
AppItem->>ContextMenu: requestAppItemMenu()
TouchUser->>AppItem: short tap (Qt.LeftButton)
AppItem->>AppItem: onClicked(mouse)
AppItem-->>ContextMenu: no request (normal left-click behavior)
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
TAG Bot New tag: 2.0.39 |
Changed touchscreen long press handling from `MouseArea.onPressAndHold` to `TapHandler.onLongPressed` to avoid conflicting behavior and duplicate menu triggers when the user releases the touch. The `isTouchLongPressed` flag is now used to skip `onClicked` processing after a long press, ensuring the menu appears only once. Log: Fixed touchscreen long press menu activation for dock app items Influence: 1. Test touchscreen long press on various dock app items; verify the context menu appears only once 2. Test touchscreen tap; ensure the app launches without unintended menu 3. Test left-click and right-click with a mouse; verify no regression in menu or drag behavior 4. Test touchscreen drag; verify drag initiation still works correctly 5. Test combined mouse and touch interactions; verify no false menu triggers fix: 修复触摸屏长按导致菜单重复弹出问题 将触摸屏长按处理从 `MouseArea.onPressAndHold` 迁移到 `TapHandler.onLongPressed`,避免了释放触摸时触发的冲突行为和菜单重复弹 出。通过 `isTouchLongPressed` 标志在 `onClicked` 中跳过处理,确保菜单只 弹出一次。 Log: 修复任务栏应用项触摸长按菜单激活问题 Influence: 1. 在多个任务栏应用项上测试触摸屏长按,验证上下文菜单仅弹出一次 2. 测试触摸屏点击,验证应用正常启动,不出现意外菜单 3. 测试鼠标左键和右键点击,验证菜单和拖拽行为无回归 4. 测试触摸屏拖拽,验证拖拽操作正常启动 5. 测试鼠标和触摸混合操作,验证无错误菜单触发 PMS: BUG-358827
deepin pr auto review这段代码修改主要涉及触摸屏长按和鼠标点击事件的交互逻辑处理。以下是对该 1. 语法逻辑审查
2. 代码质量审查
3. 代码性能审查
4. 代码安全审查
改进建议虽然代码逻辑已经比较完善,但仍有以下两点可以优化:
总结: |
Previously, only touch long-press events (mouse.button === Qt.NoButton) triggered the app item's context menu. This change also recognizes right-button long-press events, allowing touchscreen users with right- click hardware buttons to access the menu.
Log: Fixed right-click menu not working on touchscreen devices
Influence:
fix: 在触摸屏上支持通过长按右键弹出菜单
之前只有触摸长按事件(mouse.button === Qt.NoButton)能触发应用项的右键
菜单。此次变更同时识别右键长按事件,允许带有右键硬件按钮的触摸屏用户访问
菜单。
Log: 修复触摸屏设备右键菜单无法使用的问题
Influence:
PMS: BUG-358827
Summary by Sourcery
Bug Fixes: