Uploaded image for project: 'Qt for Python'
  1. Qt for Python
  2. PYSIDE-2053

Windows: QMenu wrong position in system tray when switching from small to large screen

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 6.2.4
    • PySide
    • None
    • Windows

    Description

      Hello,

      When adding a QMenu to a QSystemTrayIcon the menu ends up in the wrong position when you switch from a small to a large screen.

      The issue can be easily replicable by simply launching it on a laptop screen, then switching to a monitor with higher DPI.

      I saw this ticket but it has been closed and was reported as fixed: QTBUG-63006

      Seems there are some issues with the Jira server so I cannot attach anything right now, code can be found below for now.

      // code placeholder
      from PySide6.QtWidgets import QApplication, QMenu, QSystemTrayIcon
      from PySide6.QtGui import QAction, QIcon
      
      
      if __name__ == '__main__':
          app = QApplication([])
      
          # Create the tray
          tray = QSystemTrayIcon(icon=(QIcon("icon.png")))
          tray.setVisible(True)
      
          # Create the right click menu
          menu = QMenu()
          menu.setToolTipsVisible(True)
      
          # Add an example option
          menu_option = QAction("Example")
          menu.addAction(menu_option)
      
          # Add the menu to the tray
          tray.setContextMenu(menu)
      
          # Launch GUI
          app.exec()
      
      

       

      Attachments

        1. CyZoXnDHNY.png
          4 kB
          Andreas Johnsson
        2. QSystemTraySimpleTest.7z
          2 kB
          Andreas Johnsson
        3. zvoh69V4nl.png
          1.58 MB
          Andreas Johnsson

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              crmaurei Cristian Maureira-Fredes
              andreas_ Andreas Johnsson
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes