mirror of
https://github.com/ankitects/anki.git
synced 2026-01-07 02:53:54 -05:00
Updated the code to only monitor focus if the window was active when the tooltip was created
This commit is contained in:
parent
eb42e901d7
commit
c3239453a4
2 changed files with 11 additions and 10 deletions
|
|
@ -1 +1 @@
|
|||
Subproject commit 0b7c530233390d73b706f012bbe7489539925c7d
|
||||
Subproject commit dad4e2736a2b53dcdb52d79b5703dd464c05d666
|
||||
|
|
@ -1103,16 +1103,16 @@ def tooltip(
|
|||
lab.move(aw.mapToGlobal(QPoint(0 + x_offset, aw.height() - y_offset)))
|
||||
lab.show()
|
||||
window = aw.window() if hasattr(aw, "window") else aw
|
||||
if window is None:
|
||||
window = aw
|
||||
|
||||
was_active = window.isActiveWindow() if window else False
|
||||
|
||||
def close_if_parent_inactive() -> None:
|
||||
if not _tooltipLabel or window is None:
|
||||
return
|
||||
if (
|
||||
not window.isActiveWindow()
|
||||
or not window.isVisible()
|
||||
not window.isVisible()
|
||||
or (window.windowState() & Qt.WindowState.WindowMinimized)
|
||||
or (was_active and not window.isActiveWindow())
|
||||
):
|
||||
closeTooltip()
|
||||
|
||||
|
|
@ -1124,11 +1124,12 @@ def tooltip(
|
|||
pass
|
||||
_tooltipFocusTimer = None
|
||||
|
||||
focus_timer = QTimer(lab)
|
||||
focus_timer.setInterval(100)
|
||||
qconnect(focus_timer.timeout, close_if_parent_inactive)
|
||||
focus_timer.start()
|
||||
_tooltipFocusTimer = focus_timer
|
||||
if was_active:
|
||||
focus_timer = QTimer(lab)
|
||||
focus_timer.setInterval(100)
|
||||
qconnect(focus_timer.timeout, close_if_parent_inactive)
|
||||
focus_timer.start()
|
||||
_tooltipFocusTimer = focus_timer
|
||||
_tooltipTimer = aqt.mw.progress.timer(
|
||||
period, closeTooltip, False, requiresCollection=False, parent=aw
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in a new issue