Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-99627

QSystemTrayIcon and nested QMenu failed to display right-arrow or activable icon with PyQt6 and PySide2 on MacOs Monterey (12.1)

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.2.2
    • GUI: Menus
    • None
    • macOS

    Description

      Hello,

      I have an UI issue with the QSystemTrayIcon on PyQt6 and PySide2 with the following code. The console log when the mouse roll over the systray icon and the menu displayed is not decorated. I put the screenshot in attachement

      "CoreSVG has logged an error. Set environment variabe "CORESVG_VERBOSE" to learn more."

      The output file logged with CORESVG_VERBOSE=1 is in attachement labels coresvg.log

      I'm on macos Monterey 12.1 with PySide2 5.15.2 and the same issue with PyQt6-Qt6 6.2.2.

      Does i miss something ?

      Thanks for all you amazing works.

      import sys
      from PySide2 import QtWidgets
      from PySide2.QtGui import QIcon
      
      class SystemTrayIcon(QtWidgets.QSystemTrayIcon):
      
      def__init__(self, icon, parent=None):
       
      QtWidgets.QSystemTrayIcon.__init__(self, icon, parent)
      menu = QtWidgets.QMenu(parent)
      action : QtWidgets.QAction = menu.addAction("Item 1")
      menu.addAction("Item 2")
      disabledItem = menu.addAction("Item 3 Disabled")
      disabledItem.setDisabled(True)
      subMenu = menu.addMenu("Item 4 with sub menu")
      subMenu.addAction("SubMenu 1")
      disabledSubMenu = subMenu.addAction("SubMenu 2 Disabled (Not Working)")
      disabledSubMenu.setDisabled(True)
      disabledSubMenu2 = subMenu.addMenu("SubMenu Disabled")
      disabledSubMenu2.setDisabled(True)
      self.setContextMenu(menu)
      
      def main():
      app = QtWidgets.QApplication(sys.argv)
      style = app.style()
      
      w = QtWidgets.QWidget()
      trayIcon = SystemTrayIcon(QIcon(style.standardPixmap(QtWidgets.QStyle.SP_FileIcon)))
      
      trayIcon.show()
      sys.exit(app.exec_())
      
      if __name__ == '__main__':
      main()
       

      Attachments

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            carlton76fr carlton76fr
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: