fix: show dock context menu on long press release#1571
Conversation
|
TAG Bot New tag: 2.0.39 |
|
TAG Bot New tag: 2.0.40 |
|
TAG Bot New tag: 2.0.41 |
2fa95bd to
2dedacb
Compare
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
deepin pr auto review你好!我是CodeGeeX。我已仔细审查了你提供的Git Diff代码。本次修改主要是将QML中的 以下是我从语法逻辑、代码质量、代码性能和代码安全四个维度提出的详细审查意见和改进建议: 1. 语法与逻辑
2. 代码质量
3. 代码性能
4. 代码安全
💡 改进建议与重构代码建议将两个 改进后的代码: TapHandler {
id: tapHandler
// 只接受鼠标左键和右键(触摸屏的Tap不依赖button,会被自动识别)
acceptedButtons: Qt.LeftButton | Qt.RightButton
onTapped: function (eventPoint, button) {
// 1. 处理鼠标左键 或 触摸屏点击
if (button === Qt.LeftButton || eventPoint.device === PointerDevice.TouchScreen) {
Applet.openWorkspace()
toolTip.close()
}
// 2. 如果需要保留右键菜单功能,不应该在这里拦截右键
// 如果确定不需要右键菜单,当前逻辑是安全的;否则需要移除 Qt.RightButton
}
}如果你坚决需要隔离鼠标和触摸屏的逻辑(例如触摸屏需要特殊防抖处理),改进后的双Handler代码应为: TapHandler {
id: mouseTapHandler
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad // 明确只接受鼠标/触控板
acceptedButtons: Qt.LeftButton // 只接受左键,右键事件放行给其他组件(如菜单)
onTapped: function (eventPoint, button) {
if (button === Qt.LeftButton) {
Applet.openWorkspace()
toolTip.close()
}
}
}
TapHandler {
id: touchTapHandler
acceptedDevices: PointerDevice.TouchScreen // 明确只接受触摸屏
// 触摸屏Tap不需要判断button
onTapped: function (eventPoint, button) {
Applet.openWorkspace()
toolTip.close()
}
}总结: 最推荐第一种(单Handler)方案,它更简洁、性能更好,且避免了事件吞没的问题。请根据你的实际业务需求(特别是右键菜单是否需要存在)调整 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, fly602 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 |
Previously the dock context menu opened immediately on the longPressed signal, which could cause unexpected behavior while the user was still pressing. Now the menu only appears after the long press is released, providing a more natural and predictable interaction.
Log: Changed dock long press behavior to show context menu on release instead of immediately
Influence:
fix: 修复任务栏长按上下文菜单在松开时才显示
此前任务栏上下文菜单在 longPressed 信号触发时立即打开,可能导致用户仍在
按压时出现意外行为。现在菜单仅在长按松开后显示,提供更自然和可预测的交互
体验。
Log: 修改任务栏长按行为,上下文菜单在松开时显示而非立即显示
Influence:
PMS: BUG-358827
Change-Id: I23597cf45ae2c4cea634eb525a6ad09bde5fc89a