mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -04:00
work around tray widget being a top level widget
This commit is contained in:
parent
8e0df4aaa4
commit
bb083ab965
1 changed files with 3 additions and 0 deletions
|
@ -18,6 +18,7 @@ class AnkiTrayIcon(QtCore.QObject):
|
||||||
if (QtGui.QSystemTrayIcon.isSystemTrayAvailable() and
|
if (QtGui.QSystemTrayIcon.isSystemTrayAvailable() and
|
||||||
mw.config['showTrayIcon']):
|
mw.config['showTrayIcon']):
|
||||||
self.ti = QtGui.QSystemTrayIcon(mw)
|
self.ti = QtGui.QSystemTrayIcon(mw)
|
||||||
|
self.ti.setObjectName("trayIcon")
|
||||||
if self.ti:
|
if self.ti:
|
||||||
QtGui.QApplication.setQuitOnLastWindowClosed(False)
|
QtGui.QApplication.setQuitOnLastWindowClosed(False)
|
||||||
self.mw.addHook("quit", self.onQuit)
|
self.mw.addHook("quit", self.onQuit)
|
||||||
|
@ -46,6 +47,8 @@ class AnkiTrayIcon(QtCore.QObject):
|
||||||
activeWindow = QtGui.QApplication.activeModalWidget()
|
activeWindow = QtGui.QApplication.activeModalWidget()
|
||||||
for w in QtGui.QApplication.topLevelWidgets():
|
for w in QtGui.QApplication.topLevelWidgets():
|
||||||
if w.isWindow() and not w.isHidden():
|
if w.isWindow() and not w.isHidden():
|
||||||
|
if not w.children():
|
||||||
|
continue
|
||||||
w.hide()
|
w.hide()
|
||||||
self.tray_hidden.append(w)
|
self.tray_hidden.append(w)
|
||||||
self.anki_visible = False
|
self.anki_visible = False
|
||||||
|
|
Loading…
Reference in a new issue