Important: Please read the Qt Code of Conduct -

System Tray Icon in Application linked to a static Qt

  • I have compiled Qt 4.7.2 statically by following this link:

    Now, using the System Tray example from C:\Qt\4.7.2\examples\desktop\systray , I succeed to compile and run it, however the icons from the system tray were not loaded. Looks like I got some problem with the embedded resources, which are supposed to be statically added in the executable file. The example source code contains:



    @iconComboBox->addItem(QIcon(":/images/bad.svg"), tr("Bad"));
    iconComboBox->addItem(QIcon(":/images/heart.svg"), tr("Heart"));
    iconComboBox->addItem(QIcon(":/images/trash.svg"), tr("Trash"));@

    I can run the same example without any problem with the icons if I link the application with a shared compilation of Qt.

  • You must link to XML and SVG static plugins. There are some qmake config variables to add those to the build automatically. You'll have to fire up Qt Assistant for a search.

  • I think XML and SVG are not plugins, they are part of the Qt library. When compiling the Qt libraries, there is not such option to add them, only libjpeg, zlib ...

  • xml and svg are no plugins, that's correct. but they a libraries of qt.
    you need to link them in the pro file:

    QT += core gui xml svg

  • "Almost". QtSvg is the SVG module for Qt; if you want to read an image with QImageReader (or anything that uses it) an image plugin is required (qsvg in this case).

  • I came across the same issue. But I still don't know how to fix it.
    The method here doesn't work.
    Anyone can help?

Log in to reply