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

QSystemTrayIcon::showMessage doesn't show custom icon in KDE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • 6.9.2
    • None
    • Manjaro 6.12.48-1
    • Linux/Wayland

      Shows a tray popup without the custom icon:

      import os
      import sys
      
      from PySide6.QtGui import QIcon
      from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton, QSystemTrayIcon
      
      
      # Subclass QMainWindow to customize your application's main window
      class MainWindow(QMainWindow):
          def __init__(self):
              super().__init__()
      
              self.setWindowTitle("My App")
      
              button = QPushButton("Press Me!")
      
              # Set the central widget of the Window.
              self.setCentralWidget(button)
      
              self.systemTrayIcon = QSystemTrayIcon(self)
              iconFilePath = os.path.join(os.path.dirname(__file__), "icon.png")
              icon = QIcon()
              icon.addFile(iconFilePath)
              self.systemTrayIcon.setIcon(icon)
              self.systemTrayIcon.show()
      
              button.clicked.connect(
                  lambda: self.systemTrayIcon.showMessage("Example", "msg", icon, 1000)
              )
      
      
      app = QApplication(sys.argv)
      
      window = MainWindow()
      window.show()
      
      app.exec()
      

       

       

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

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

              Created:
              Updated:

                There are no open Gerrit changes