From d031658b3a20a0ea443c32d605da5e887b0457ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Wed, 17 Apr 2024 14:41:30 +0800 Subject: [PATCH] fix --- LunaTranslator/LunaTranslator/gui/settin.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/settin.py b/LunaTranslator/LunaTranslator/gui/settin.py index 59b03d9c..e0ff5131 100644 --- a/LunaTranslator/LunaTranslator/gui/settin.py +++ b/LunaTranslator/LunaTranslator/gui/settin.py @@ -154,7 +154,9 @@ class Settin(closeashidewindow): self, triggered=lambda: gobject.baseobject.settin_ui.showsignal.emit(), ) - quitAction = QAction(_TR("&退出"), self, triggered=gobject.baseobject.translation_ui.close) + quitAction = QAction( + _TR("&退出"), self, triggered=gobject.baseobject.translation_ui.close + ) self.trayMenu = QMenu(self) self.trayMenu.addAction(showAction) self.trayMenu.addAction(settingAction) @@ -260,7 +262,7 @@ class Settin(closeashidewindow): class WindowEventFilter(QObject): def eventFilter(_, obj, event): if event.type() == QEvent.Type.WinIdChange: - if obj == self.parent(): + if obj.testAttribute(Qt.WA_TranslucentBackground): return False hwnd = obj.winId() if hwnd: # window create/destroy,when destroy winId is None @@ -272,7 +274,7 @@ class Settin(closeashidewindow): self.__filter = WindowEventFilter() # keep ref QApplication.instance().installEventFilter(self.__filter) for widget in QApplication.topLevelWidgets(): - if widget == self.parent(): + if widget.testAttribute(Qt.WA_TranslucentBackground): continue winsharedutils.SetTheme( int(widget.winId()), dark, globalconfig["WindowBackdrop"]