fix: separate touchscreen and mouse context menu triggers in notifica…#1554
Merged
Ivy233 merged 1 commit intoApr 15, 2026
Merged
Conversation
Reviewer's GuideSplits the notification center context-menu TapHandler into separate mouse/touchpad and touchscreen handlers with device filtering so that mouse right-click still opens the context menu while a single-finger tap on touchscreens only expands notifications, reserving long-press for the context menu. Sequence diagram for separated context menu TapHandlers in notification centersequenceDiagram
actor User
participant PointerDevice as PointerDevice_event
participant MouseTapHandler as Mouse_TapHandler
participant TouchTapHandler as Touchscreen_TapHandler
participant NotifyViewDelegate as NotifyViewDelegate
participant ContextMenu as ContextMenu
rect rgb(230,230,250)
User->>PointerDevice: right_click
PointerDevice->>MouseTapHandler: tap_event(Qt.RightButton, device=Mouse)
MouseTapHandler-->>TouchTapHandler: no_event
MouseTapHandler->>MouseTapHandler: onPressedChanged(pressed=true)
MouseTapHandler->>NotifyViewDelegate: setting(pos)
NotifyViewDelegate->>ContextMenu: open_at(pos)
end
rect rgb(230,255,230)
User->>PointerDevice: single_finger_tap
PointerDevice->>TouchTapHandler: tap_event(device=TouchScreen)
TouchTapHandler-->>MouseTapHandler: no_event
TouchTapHandler->>NotifyViewDelegate: expand_notification
NotifyViewDelegate->>ContextMenu: no_action
end
rect rgb(255,250,230)
User->>PointerDevice: long_press
PointerDevice->>TouchTapHandler: long_press_event(device=TouchScreen)
TouchTapHandler->>TouchTapHandler: onLongPressed()
TouchTapHandler->>NotifyViewDelegate: setting(pos)
NotifyViewDelegate->>ContextMenu: open_at(pos)
end
Flow diagram for device-filtered TapHandler routingflowchart TD
A[Pointer event in NotifyViewDelegate] --> B{PointerDevice type}
B -->|Keyboard| C[Mouse_TapHandler]
B -->|Mouse| C
B -->|TouchPad| C
B -->|TouchScreen| D[Touchscreen_TapHandler]
C --> E{Button == Qt.RightButton and pressed}
E -->|yes| F[call setting pos then open context menu]
E -->|no| G[no context menu from Mouse_TapHandler]
D --> H{Gesture type}
H -->|long_press| F
H -->|tap| I[expand or select notification only]
H -->|other| J[ignore for context menu]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The mouse and touchscreen TapHandler blocks are duplicated in two places; consider extracting them into a shared component or helper to avoid repetition and keep behavior consistent between sections.
- If pen/stylus or other pointing devices are expected in this UI, consider whether they should be treated like mouse/touchpad or touchscreen and update the acceptedDevices masks accordingly.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The mouse and touchscreen TapHandler blocks are duplicated in two places; consider extracting them into a shared component or helper to avoid repetition and keep behavior consistent between sections.
- If pen/stylus or other pointing devices are expected in this UI, consider whether they should be treated like mouse/touchpad or touchscreen and update the acceptedDevices masks accordingly.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
18202781743
reviewed
Apr 15, 2026
…tion center Split the context menu TapHandler into two separate handlers with device filtering to prevent touchscreen tap from incorrectly triggering the context menu when expanding collapsed notifications: 1. Mouse/other devices handler: uses acceptedDevices with PointerDevice.AllDevices & ~PointerDevice.TouchScreen to exclude touchscreen, as touchscreen events bypass acceptedButtons check in Qt 2. Touchscreen handler: only accepts long-press gesture from TouchScreen device This ensures that a single-finger tap on a collapsed notification only expands it without showing the context menu, while long-press still triggers the menu as expected. Log: fix touchscreen tap incorrectly triggering context menu when expanding collapsed notifications fix: 通知中心分离触摸屏和鼠标右键菜单触发方式 将右键菜单的 TapHandler 拆分为两个独立的处理器,并添加设备过滤, 防止触摸屏点击展开折叠通知时错误地触发右键菜单: 1. 鼠标/其他设备处理器:使用 acceptedDevices 设置为 PointerDevice.AllDevices & ~PointerDevice.TouchScreen 排除触摸屏, 因为 Qt 中触摸屏事件会绕过 acceptedButtons 检查 2. 触摸屏处理器:仅接受来自触摸屏设备的长按手势 这确保了在折叠通知上单指点击只会展开通知而不会显示右键菜单, 同时长按仍然可以按预期触发菜单。 Log: 修复触摸屏点击展开折叠通知时错误触发右键菜单的问题 PMS: BUG-355017
5acc8af to
2da197f
Compare
18202781743
approved these changes
Apr 15, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, Ivy233 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…tion center
Split the context menu TapHandler into two separate handlers with device filtering to prevent touchscreen tap from incorrectly triggering the context menu when expanding collapsed notifications:
This ensures that a single-finger tap on a collapsed notification only expands it without showing the context menu, while long-press still triggers the menu as expected.
Log: fix touchscreen tap incorrectly triggering context menu when expanding collapsed notifications
fix: 通知中心分离触摸屏和鼠标右键菜单触发方式
将右键菜单的 TapHandler 拆分为两个独立的处理器,并添加设备过滤,
防止触摸屏点击展开折叠通知时错误地触发右键菜单:
这确保了在折叠通知上单指点击只会展开通知而不会显示右键菜单,
同时长按仍然可以按预期触发菜单。
Log: 修复触摸屏点击展开折叠通知时错误触发右键菜单的问题
PMS: BUG-355017
Summary by Sourcery
Separate mouse and touchscreen context menu triggers in the notification center to avoid accidental context menu activation when expanding notifications.
Bug Fixes:
Enhancements: