I followed the The Qt Resource System guide and the .ico icons appear on Linux.
The icons are not showing up on Windows when I try to run the applicaton from Qt Creator.
I suspect a plugin issue based on Qt/C++: Icons not showing up when program is run under windows O.S but I failed to figure out what to do from the guide How to Create Qt Plugins.
Is it a plugin issue or why aren't the icons showing up on Windows?
If it is a plugin issue: How do I tell my applicaton where to find the qico.dll?
Details of the environment:
Works on: Kubuntu 12.04 LTS, Qt Creator 2.4.1 and Qt 4.7.4 (64 bit)
Fails on: Windows XP SP2 32 bit, Qt Creator 2.4.1 and Qt 4.7.4 (32 bit)
Everyting is at its default (as installed out of the box), I did not mess with the settings.
resources.qrc
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>images/spreadsheet.ico</file>
</qresource>
</RCC>
Also tried with <qresource prefix="/">
.
From the applicaton.pro
RESOURCES += \
resources.qrc
OTHER_FILES += \
images/spreadsheet.ico
In the corresponding source file
QIcon(":/images/spreadsheet.ico")
I also tried as written in Deploying an Application on Windows
QDir plugins(QCoreApplication::applicationDirPath()+"/plugins");
qDebug() << "Plugin directory" << plugins.absolutePath() << "found?" << plugins.exists();
app.addLibraryPath(plugins.absolutePath());
with the qico.dll in the plugins directory. It application prints that the plugins directory exists but the icons still don't show up.
I repeat: it works on Linux.
ico
format is supported by QIcon or try convert to different format likepng
. – Blenico
format, then you have an answer. You should list supported formats usingQImageReader::supportedImageFormats ()
function and see ifico
is there on your Windows machine. – Blenimageformats
directory from Qt'splugin
directory into your application folder (where executable is). It should work then. – Blenimageformats
should be in application folder (so if your app is inc:\myapp
you should havec:\myapp\imageformats
folder notc:\myapp\plugins\imageformats
) and you don't have to set anything. Also make sure thatqico4.dll
andqicod4.dll
(if you build in debug mode) are there. – Blen