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

QSystemTrayIcon does not render SVGs on arch

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Not Evaluated
    • Resolution: Duplicate
    • Affects Version/s: 5.15.2
    • Fix Version/s: None
    • Component/s: PySide
    • Labels:
      None
    • Platform/s:
      Linux/X11

      Description

      Hi,

      when instanciating QSystemTrayIcon with a QIcon initialized from a SVG file, it does not render, but it still is clickable and shows a menu. You can find a screenshot at this related issue.

      Weirdly, the issue occurs only inside plasma, but not inside e.g. awesome-wm on the same system. Furthermore, the issue occurs only with the arch's system package of PyQt5, but not with the one installed using `pip install` into a virtualenv (same version of python/pyqt otherwise).

      Example python code:

      from PyQt5.QtGui import QIcon
      from PyQt5.QtWidgets import QApplication, QSystemTrayIcon
      import signal
      import sys
      
      app = QApplication(sys.argv)
      signal.signal(signal.SIGINT, signal.SIG_DFL)
      icon = QIcon('tray.svg')
      tray = QSystemTrayIcon(icon)
      tray.show()
      app.exec_()
      

      Example tray.svg:

      <?xml version="1.0" encoding="UTF-8" standalone="no"?>
      <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
      <svg width="128" height="128" viewBox="0 0 100 100" version="1.1" xmlns="http://www.w3.org/2000/svg">
      <path stroke="#000000" fill="none" stroke-width="12" d="M 20,35 L 40,75 L 80,25"/>
      </svg>
      

      A workaround is to convert the icon to QPixmap and back:

      icon = QIcon(QIcon('tray.svg').pixmap(32))
      

      Furthermore, if executing the program from a remote login session (SSH, setting DISPLAY=:0 to the running session) the icon shows correctly inside plasma even without the workaround, and with using arch's system python/pyqt. However, not anymore after setting the environment variable KDE_FULL_SESSION to any value.

      On the other hand, when running inside plasma, the presence of KDE_FULL_SESSION and other KDE related variables does not prevent the issue, and setting them does not cause the behaviour when running the PyPI version.

      I originally added this info to QTBUG-53550 and was asked by Liang Qi (Personal) to report this here.

       

      The archlinux packaging scripts are easy to obtain from archlinux.org, e.g. here the one for python-pyqt5 and then looking at Source Files -> PKGBUILD. The site also links all the build and runtime dependencies.

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              crmaurei Cristian Maureira-Fredes
              Reporter:
              coldfix Thomas G
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes