Closed encody closed 2 years ago
Thanks for reporting the bug. I think this is likely related to Qt on Windows. I'll have a look soon though.
I have investigated this issue further and using the test script below the menu is displayed in the correct position. So the issue seems related to my implementation or to how anki manages the add on.
import sys
from PyQt5.QtGui import QIcon, QPixmap
from PyQt5.QtWidgets import QApplication, QMenu, QSystemTrayIcon, QDialog
class App:
def __init__(self):
# Create a Qt application
self.app = QApplication(sys.argv)
icon = QIcon("C:\sharedLinux\home.png")
menu = QMenu()
settingAction = menu.addAction("setting")
settingAction.triggered.connect(self.setting)
exitAction = menu.addAction("exit")
exitAction.triggered.connect(sys.exit)
self.tray = QSystemTrayIcon()
self.tray.setIcon(icon)
self.tray.setContextMenu(menu)
self.tray.show()
self.tray.setToolTip("unko!")
def run(self):
# Enter Qt application main loop
self.app.exec_()
sys.exit()
def setting(self):
self.dialog = QDialog()
self.dialog.setWindowTitle("Setting Dialog")
self.dialog.show()
if __name__ == "__main__":
app = App()
app.run()
I have tried to ask on the QtForum: https://forum.qt.io/topic/96026/qmenu-in-qsytemtrayicon-misplaced-in-windows-10
Does this issue still happen?
Thanks for the addon, so far so good.
I'm on Windows 10, and when I right-click on the icon, this is what appears:
The right-click menu is misplaced: instead of appearing right next to the mouse, it appears in the lower-right corner of the screen.
Anki installation: Version 2.1.4 Qt 5.9.2 PyQt 5.9