From abd9586defd7234487f00992918189e0f59de8e4 Mon Sep 17 00:00:00 2001 From: dwuggh Date: Sun, 12 Oct 2025 04:00:45 +0800 Subject: [PATCH] fix(bar): keep bar visible while hovering any widget by using HoverHandler on container instead of relying on background MouseArea Problem: Parent MouseArea sat below bar content, so when the pointer hovered a child widget that handled hover, the parent did not see hover and barHovered became false, causing auto-hide to trigger unexpectedly. Solution: Add a non-invasive HoverHandler on the bar container to drive barHovered, without stealing events from child widgets. Remove hover handling from the background MouseArea (kept for right-click). Also respects auto-hide timers (cancel on enter; restart on exit). --- Modules/Bar/Bar.qml | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/Modules/Bar/Bar.qml b/Modules/Bar/Bar.qml index 8c40af84..593bfe15 100644 --- a/Modules/Bar/Bar.qml +++ b/Modules/Bar/Bar.qml @@ -184,6 +184,24 @@ Variants { } } + // Mark bar hovered without stealing events from child widgets + HoverHandler { + id: barHoverHandler + onHoveredChanged: { + root.barHovered = hovered + if (!root.autoHide) + return + if (hovered) { + showTimer.stop() + hideTimer.stop() + root.barWindowVisible = true + root.hidden = false + } else if (!root.peekHovered) { + hideTimer.restart() + } + } + } + // Background fill with shadow Rectangle { id: bar @@ -198,7 +216,7 @@ Variants { MouseArea { anchors.fill: parent acceptedButtons: Qt.RightButton - hoverEnabled: true + hoverEnabled: false preventStealing: true onClicked: function (mouse) { if (mouse.button === Qt.RightButton) { @@ -207,21 +225,6 @@ Variants { mouse.accepted = true } } - onEntered: { - root.barHovered = true - if (root.autoHide) { - showTimer.stop() - hideTimer.stop() - root.barWindowVisible = true - root.hidden = false - } - } - onExited: { - root.barHovered = false - if (root.autoHide && !root.peekHovered) { - hideTimer.restart() - } - } } Loader {