From ee59c2e82481ffe02f883f581b70095765fe5a0e Mon Sep 17 00:00:00 2001 From: Robertkill Date: Thu, 18 Jun 2026 15:49:42 +0800 Subject: [PATCH] fix: keep notification hover state on close button edge MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Extend the notification bubble input area to cover the close button edge outside the notification card background 2. Keep the bubble delegate width aligned with the expanded input area while preserving the 360px notification content layout and right margin 3. Use the delegate hover state to keep the close button visible and block timeout closing while the pointer stays on the edge area Influence: 1. Test notification bubble hover on the notification body and close button edge 2. Verify the close button remains visible when hovering its top-right edge 3. Verify hovered notifications do not expire automatically 4. Verify notification position and stacking animation remain unchanged fix: 保持通知关闭按钮边缘区域悬停状态 1. 扩展通知气泡输入区域,覆盖通知卡片背景外的关闭按钮边缘区域 2. 保持delegate宽度与扩展后的输入区域一致,同时保留360px通知内容布局和右边距 3. 使用delegate悬停状态保持关闭按钮显示,并在指针位于边缘区域时阻止通知超时关闭 Influence: 1. 测试通知主体和关闭按钮边缘区域的悬停效果 2. 验证鼠标悬停在右上角关闭按钮边缘时关闭按钮持续显示 3. 验证悬停状态下通知不会自动超时消失 4. 验证通知显示位置和堆叠动画保持不变 PMS: BUG-365963 --- .../bubble/package/BubbleDelegate.qml | 17 ++++++++++++++++- panels/notification/bubble/package/main.qml | 16 ++++++++++------ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/panels/notification/bubble/package/BubbleDelegate.qml b/panels/notification/bubble/package/BubbleDelegate.qml index 6c4ba6484..a1dccd0ad 100644 --- a/panels/notification/bubble/package/BubbleDelegate.qml +++ b/panels/notification/bubble/package/BubbleDelegate.qml @@ -7,7 +7,8 @@ import QtQuick.Controls 2.15 Item { id: delegateRoot - width: 360 + width: ListView.view ? ListView.view.width : 360 + property var applet property var bubble: model property int maxCount: 3 // ListView 的 remove 动画执行的时候,remove Item的index会以负数的方式出现 @@ -15,10 +16,24 @@ Item { height: bubbleContent.height z: -realIndex + + HoverHandler { + id: delegateHoverHandler + margin: 8 + onHoveredChanged: { + if (delegateRoot.applet) { + delegateRoot.applet.setHoveredId(hovered && delegateRoot.bubble ? delegateRoot.bubble.id : 0) + } + } + } + Bubble { id: bubbleContent width: 360 + anchors.right: parent.right + anchors.rightMargin: 10 bubble: delegateRoot.bubble + parentHovered: delegateHoverHandler.hovered transformOrigin: Item.Top diff --git a/panels/notification/bubble/package/main.qml b/panels/notification/bubble/package/main.qml index 426576743..7af4f547a 100644 --- a/panels/notification/bubble/package/main.qml +++ b/panels/notification/bubble/package/main.qml @@ -91,21 +91,21 @@ Window { ListView { id: bubbleView - width: 360 + width: root.width height: contentHeight anchors { right: parent.right bottom: parent.bottom - rightMargin: 10 + rightMargin: 0 bottomMargin: 10 } function updateInputRegion() { root.DLayerShellWindow.setInputRegionRect( Math.ceil(bubbleView.x), - Math.ceil(bubbleView.y), - Math.ceil(bubbleView.width), - Math.ceil(Math.max(10, bubbleView.contentHeight)) + Math.ceil(bubbleView.y - 8), + Math.ceil(root.width), + Math.ceil(Math.max(10, bubbleView.contentHeight) + 8) ) } onContentHeightChanged: updateInputRegion() @@ -167,13 +167,17 @@ Window { } delegate: BubbleDelegate { + applet: Applet maxCount: model.bubbleCount } HoverHandler { + margin: 8 onPointChanged: { const local = point.position - let hoveredItem = bubbleView.itemAt(local.x, local.y) + const x = Math.min(Math.max(local.x, 0), bubbleView.width - 1) + const y = Math.min(Math.max(local.y, 0), bubbleView.height - 1) + let hoveredItem = bubbleView.itemAt(x, y) if (hoveredItem && hoveredItem.bubble) { Applet.setHoveredId(hoveredItem.bubble.id) } else {