From 957dede6b355f8e6666d6ccbd0b9e74be6d0e9de Mon Sep 17 00:00:00 2001 From: amadoabad Date: Fri, 17 Oct 2025 02:12:21 +0300 Subject: [PATCH] Feat: Now freezes the notifications when hovering on notifications buttons too. --- Modules/Notification/Notification.qml | 35 +++++++++++++++++++++------ Widgets/NButton.qml | 4 +++ 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/Modules/Notification/Notification.qml b/Modules/Notification/Notification.qml index 757011a22..395672fd8 100644 --- a/Modules/Notification/Notification.qml +++ b/Modules/Notification/Notification.qml @@ -248,24 +248,40 @@ Variants { // Staggered animation delay based on index readonly property int animationDelay: index * 100 + property int hoverCount: 0 + + onHoverCountChanged: { + if (hoverCount > 0) { + resumeTimer.stop() + NotificationService.pauseTimeout(notificationId) + } else { + resumeTimer.start() + } + } + + Timer { + id: resumeTimer + interval: 50 + repeat: false + onTriggered: { + if (hoverCount === 0) { + NotificationService.resumeTimeout(notificationId) + } + } + } + // Right-click to dismiss MouseArea { anchors.fill: parent acceptedButtons: Qt.RightButton hoverEnabled: true + onEntered: parent.hoverCount++ + onExited: parent.hoverCount-- onClicked: { if (mouse.button === Qt.RightButton) { animateOut() } } - - onContainsMouseChanged: { - if (containsMouse) { - NotificationService.pauseTimeout(notificationId) - } else { - NotificationService.resumeTimeout(notificationId) - } - } } // Scale, fade, and slide animation @@ -493,6 +509,9 @@ Variants { delegate: NButton { property var actionData: modelData + onEntered: card.hoverCount++ + onExited: card.hoverCount-- + text: { var actionText = actionData.text || "Open" // If text contains comma, take the part after the comma (the display text) diff --git a/Widgets/NButton.qml b/Widgets/NButton.qml index 654de9526..9b97b5d2b 100644 --- a/Widgets/NButton.qml +++ b/Widgets/NButton.qml @@ -25,6 +25,8 @@ Rectangle { signal clicked signal rightClicked signal middleClicked + signal entered + signal exited // Internal properties property bool hovered: false @@ -140,12 +142,14 @@ Rectangle { onEntered: { root.hovered = true + root.entered() if (tooltipText) { TooltipService.show(Screen, root, root.tooltipText) } } onExited: { root.hovered = false + root.exited() if (tooltipText) { TooltipService.hide() }