System Tray Icon in Application linked to a static Qt
-
wrote on 11 Apr 2011, 13:11 last edited by
I have compiled Qt 4.7.2 statically by following this link: http://www.formortals.com/build-qt-static-small-microsoft-intel-gcc-compiler/
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:
@Q_INIT_RESOURCE(systray);@
and
@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.
-
wrote on 11 Apr 2011, 13:22 last edited by
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.
-
wrote on 12 Apr 2011, 02:07 last edited by
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 ...
-
wrote on 12 Apr 2011, 07:25 last edited by
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
@ -
wrote on 12 Apr 2011, 07:55 last edited by
"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).
http://doc.qt.nokia.com/4.7/plugins-howto.html#static-plugins
-
wrote on 27 Feb 2013, 09:01 last edited by
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?
Thanks!