Skip to content

The only downloader you need. 下载器的集大成者。

修复托盘菜单位置偏移问题

XiaoYouChR25bd83cf87de
diff --git a/app/components/custom_tray.py b/app/components/custom_tray.py
index bda97dba..16b135fc 100644
--- a/app/components/custom_tray.py
+++ b/app/components/custom_tray.py
@@ -3,11 +3,22 @@ from PySide6.QtGui import QIcon
from PySide6.QtWidgets import QSystemTrayIcon, QApplication
from qfluentwidgets import Action
from qfluentwidgets import FluentIcon as FIF
+from qfluentwidgets.common.screen import getCurrentScreenGeometry
from qfluentwidgets.components.material import AcrylicMenu
class FixedAcrylicSystemTrayMenu(AcrylicMenu):
- """ 修复背景获取偏移的问题 """
+ """ 修复背景获取偏移、位置偏移的问题 """
+
+ def adjustPosition(self):
+ m = self.layout().contentsMargins()
+ rect = getCurrentScreenGeometry()
+ w, h = self.layout().sizeHint().width() + 5, self.layout().sizeHint().height()
+
+ x = min(self.x() - m.left(), rect.right() - w)
+ y = self.y() - 45
+
+ self.move(x, y)
def showEvent(self, e):
super().showEvent(e)