From a1a50659d8d76517a954d44a32d9d668d4225369 Mon Sep 17 00:00:00 2001 From: junlu592 Date: Sat, 15 Nov 2025 12:23:39 +0100 Subject: [PATCH] added new app.focusWindow() check that might work on windows --- qt/aqt/utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/qt/aqt/utils.py b/qt/aqt/utils.py index 0de171d06..0899abfb8 100644 --- a/qt/aqt/utils.py +++ b/qt/aqt/utils.py @@ -1109,10 +1109,13 @@ def tooltip( def close_if_parent_inactive() -> None: if not _tooltipLabel or window is None: return + # Check if window is still active and application has focus + app_has_focus = aqt.mw.app.focusWindow() is not None + window_is_active = window.isActiveWindow() if ( not window.isVisible() or (window.windowState() & Qt.WindowState.WindowMinimized) - or (was_active and not window.isActiveWindow()) + or (was_active and (not window_is_active or not app_has_focus)) ): closeTooltip()