Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Right click menu shows up in the wrong spot #1

Closed
encody opened this issue Sep 24, 2018 · 4 comments
Closed

Right click menu shows up in the wrong spot #1

encody opened this issue Sep 24, 2018 · 4 comments
Labels
needs-info Needs more info from the reporter

Comments

@encody
Copy link

encody commented Sep 24, 2018

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:

image

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

@simgunz
Copy link
Owner

simgunz commented Oct 1, 2018

Thanks for reporting the bug. I think this is likely related to Qt on Windows. I'll have a look soon though.

@simgunz
Copy link
Owner

simgunz commented Oct 28, 2018

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()

@simgunz
Copy link
Owner

simgunz commented Oct 28, 2018

@simgunz
Copy link
Owner

simgunz commented Jul 23, 2021

Does this issue still happen?

@simgunz simgunz added the needs-info Needs more info from the reporter label Jul 23, 2021
@simgunz simgunz closed this as completed Dec 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-info Needs more info from the reporter
Projects
None yet
Development

No branches or pull requests

2 participants