centralize panel content-change grace period into HoverPanel.keepOpen()

This commit is contained in:
Damocles 2026-04-16 18:37:53 +02:00
parent 084ef1da75
commit 46f14d5d36
6 changed files with 36 additions and 19 deletions

View file

@ -92,6 +92,24 @@ PanelWindow {
}
}
// Content-change grace: call keepOpen(ms) when panel content is about to
// resize/rebuild (session switch, device list change, etc.) to prevent the
// hover-drop-on-resize from closing the panel.
property bool _contentBusy: false
Timer {
id: _contentBusyTimer
onTriggered: {
root._contentBusy = false;
if (!root.showPanel && !root._grace && !root._pinned)
root._hideTimer.restart();
}
}
function keepOpen(ms) {
_contentBusy = true;
_contentBusyTimer.interval = ms ?? 400;
_contentBusyTimer.restart();
}
function _show() {
_updatePosition();
_winVisible = true;
@ -115,7 +133,7 @@ PanelWindow {
Timer {
id: _hideTimer
interval: 150
onTriggered: if (!root.showPanel && !root._grace && !root._pinned)
onTriggered: if (!root.showPanel && !root._grace && !root._pinned && !root._contentBusy)
root.dismiss()
}