This commit is contained in:
恍兮惚兮 2024-04-17 14:41:30 +08:00
parent 416c52971e
commit d031658b3a

View File

@ -154,7 +154,9 @@ class Settin(closeashidewindow):
self, self,
triggered=lambda: gobject.baseobject.settin_ui.showsignal.emit(), 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 = QMenu(self)
self.trayMenu.addAction(showAction) self.trayMenu.addAction(showAction)
self.trayMenu.addAction(settingAction) self.trayMenu.addAction(settingAction)
@ -260,7 +262,7 @@ class Settin(closeashidewindow):
class WindowEventFilter(QObject): class WindowEventFilter(QObject):
def eventFilter(_, obj, event): def eventFilter(_, obj, event):
if event.type() == QEvent.Type.WinIdChange: if event.type() == QEvent.Type.WinIdChange:
if obj == self.parent(): if obj.testAttribute(Qt.WA_TranslucentBackground):
return False return False
hwnd = obj.winId() hwnd = obj.winId()
if hwnd: # window create/destroy,when destroy winId is None if hwnd: # window create/destroy,when destroy winId is None
@ -272,7 +274,7 @@ class Settin(closeashidewindow):
self.__filter = WindowEventFilter() # keep ref self.__filter = WindowEventFilter() # keep ref
QApplication.instance().installEventFilter(self.__filter) QApplication.instance().installEventFilter(self.__filter)
for widget in QApplication.topLevelWidgets(): for widget in QApplication.topLevelWidgets():
if widget == self.parent(): if widget.testAttribute(Qt.WA_TranslucentBackground):
continue continue
winsharedutils.SetTheme( winsharedutils.SetTheme(
int(widget.winId()), dark, globalconfig["WindowBackdrop"] int(widget.winId()), dark, globalconfig["WindowBackdrop"]