fix: move TapHandler outside MouseArea to fix event handling#1528
Merged
wjyrich merged 1 commit intolinuxdeepin:masterfrom Mar 24, 2026
Merged
fix: move TapHandler outside MouseArea to fix event handling#1528wjyrich merged 1 commit intolinuxdeepin:masterfrom
wjyrich merged 1 commit intolinuxdeepin:masterfrom
Conversation
Moved the TapHandler from inside the MouseArea to be a direct child of the NotifyItem. This change resolves event handling conflicts where the TapHandler was not receiving taps properly due to being nested within the MouseArea. The TapHandler is now positioned after the MouseArea in the QML structure, ensuring it can properly capture tap events for expanding notifications when enabled. Log: Fixed notification expansion not working when clicking on certain areas Influence: 1. Test clicking on notification items to ensure they expand correctly 2. Verify that notifications with enableDismissed=false can be expanded via tap 3. Test keyboard navigation with Enter/Return keys still works for expansion 4. Verify that dismissed notifications (enableDismissed=true) cannot be expanded 5. Check that focus handling works correctly when tapping notifications fix: 将 TapHandler 移出 MouseArea 以修复事件处理 将 TapHandler 从 MouseArea 内部移动到 NotifyItem 的直接子元素。此更改解 决了事件处理冲突,由于 TapHandler 嵌套在 MouseArea 内导致无法正确接收点 击事件的问题。现在 TapHandler 在 QML 结构中位于 MouseArea 之后,确保在启 用时能够正确捕获用于展开通知的点击事件。 Log: 修复了点击某些区域时通知无法展开的问题 Influence: 1. 测试点击通知项以确保它们能正确展开 2. 验证 enableDismissed=false 的通知可以通过点击展开 3. 测试键盘导航,确保 Enter/Return 键仍能用于展开 4. 验证已关闭的通知(enableDismissed=true)无法展开 5. 检查点击通知时的焦点处理是否正常工作 PMS: BUG-353605
Reviewer's guide (collapsed on small PRs)Reviewer's GuideMoves the notification expansion TapHandler out of the inner MouseArea to become a direct child of NotifyItem, resolving event-handling conflicts so tap-to-expand works correctly while preserving keyboard expansion behavior. Sequence diagram for tap-to-expand notification after TapHandler relocationsequenceDiagram
actor User
participant QtInputSystem
participant TapHandler
participant NotifyItem
User->>QtInputSystem: Tap on notification area
QtInputSystem->>TapHandler: Deliver left button tap
TapHandler->>TapHandler: Check enabled (!root.enableDismissed)
alt enabled is true
TapHandler->>NotifyItem: forceActiveFocus()
TapHandler->>NotifyItem: expand()
else enabled is false (enableDismissed is true)
TapHandler-->>NotifyItem: No action (tap ignored)
end
Class diagram for updated OverlapNotify QML hierarchyclassDiagram
class NotifyItem {
bool enableDismissed
+forceActiveFocus()
+expand()
}
class MouseArea {
// existing click handling (unchanged)
+onPressed
+onReleased
+onClicked
}
class TapHandler {
bool enabled
Qt.MouseButtons acceptedButtons
+onTapped()
}
NotifyItem *-- MouseArea : contains
NotifyItem *-- TapHandler : contains
TapHandler : enabled = !root.enableDismissed
TapHandler : acceptedButtons = Qt.LeftButton
TapHandler : onTapped => root.forceActiveFocus()
TapHandler : onTapped => root.expand()
class KeysHandler {
+onEnterPressed()
+onReturnPressed()
}
NotifyItem *-- KeysHandler : key events
KeysHandler : onEnterPressed => root.expand()
KeysHandler : onReturnPressed => root.expand()
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
mhduiy
approved these changes
Mar 24, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: mhduiy, 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 |
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.
Moved the TapHandler from inside the MouseArea to be a direct child of the NotifyItem. This change resolves event handling conflicts where the TapHandler was not receiving taps properly due to being nested within the MouseArea. The TapHandler is now positioned after the MouseArea in the QML structure, ensuring it can properly capture tap events for expanding notifications when enabled.
Log: Fixed notification expansion not working when clicking on certain areas
Influence:
fix: 将 TapHandler 移出 MouseArea 以修复事件处理
将 TapHandler 从 MouseArea 内部移动到 NotifyItem 的直接子元素。此更改解 决了事件处理冲突,由于 TapHandler 嵌套在 MouseArea 内导致无法正确接收点
击事件的问题。现在 TapHandler 在 QML 结构中位于 MouseArea 之后,确保在启 用时能够正确捕获用于展开通知的点击事件。
Log: 修复了点击某些区域时通知无法展开的问题
Influence:
PMS: BUG-353605
Summary by Sourcery
Bug Fixes: