[Qt-interest] Trying to use ICO icons in a dll linked to static QT4.5.3

Scott Aron Bloom Scott.Bloom at sabgroup.com
Thu Oct 29 15:25:33 CET 2009


You should probably setup your configuration to have the ico built into
qt rather than have it as a plugin

Scott

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Yuvraaj Kelkar
Sent: Thursday, October 29, 2009 7:11 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] Trying to use ICO icons in a dll linked to static
QT4.5.3

Hi all,

I have created a DLL that links statically to QT 4.5.3
This DLL has 3 .ico files compiled into it using a qrc.
I have already compiled QT statically.

Initializing the QIcon does not show any errors, enumerating the 
resource contents using QDir shows that my ico files exist and are 
accessible.
When I actually showing those icons - in my case in the system tray 
using QSystemTrayIcon - no icon is displayed.

QSystemTrayIcon itself works - I can click, right click, hover over the 
"blank space" created by the class in the tray. It just cannot show an
icon.

I debug stepped into the QSystemTrayIcon::setIcon to see what the 
problem was. Turns out that there is no ICO pixmap handler.
I guess that this is because the ico plugin has not been loaded / 
compiled into my dll.

So I tried loading the qico plugin as explained in:
http://doc.trolltech.com/4.5/qtplugin.html#Q_IMPORT_PLUGIN
http://doc.trolltech.com/4.5/plugins-howto.html#static-plugins

In my .pro:
static {
     QTPLUGIN += qico
     DEFINES += STATIC
     message("Static build")
}

and in my source file:
#ifdef STATIC
#include <QtPlugin>
Q_IMPORT_PLUGIN(qico)
#endif

With this I get link errors:
         link /LIBPATH:"c:\qt\lib" /NOLOGO /DEBUG /DLL /MANIFEST 
/MANIFESTFILE:"debug\zcmn.intermediate.manifest" /OUT:debug\mydll.dll 
@C:\DOCUME~1\Uv\LOCALS~1\Temp\nm2696.tmp
LINK : fatal error LNK1104: cannot open file 'qicod.lib'

I looked into my qt folder for a lib file called qico.lib and qicod.lib:

Neither was present.
I looked into \qt\src\plugins\imageformats\ico\tmp\obj\ and found the 
debug_static and release_static folders with qicohandler.obj compiled in

both.

This is the command I used to configure QT to build statically:
.\configure.exe -debug-and-release -static -no-fast -no-exceptions 
-accessibility -no-stl -plugin-sql-sqlite -no-qt3support -no-opengl 
-platform win32-msvc2008 -graphicssystem raster -no-incredibuild-xge 
-plugin-manifests -qmake -process -no-rtti -3dnow -sse -no-openssl -dbus

-no-phonon -no-phonon-backend -no-webkit -no-scripttools -arch windows 
-no-style-motif -no-style-cde -no-style-cleanlooks -no-style-plastique 
-nomake examples -nomake demos

Followed by:
nmake sub-src

I've Googled for the last one week looking for an answer. Any help would

be appreciated. Anything - even moral support!

Thanks,
Uv

_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list