PDA

View Full Version : Icons are not visible when installing Qt application on end user machine ( Windows )



freely
18th February 2011, 07:37
Hello,
I am junior software developer. I develop descktop applications using Qt application framework for 3 years. Currently I develop application that I putted(added) icons to it’s menues’ QActions, to buttons, to frames and windows, to textedit. I’ve created .qrc resource file and added icons from the resource file. I need to install the application on end user Windows XP(7) machine installing only .exe file and .dll libraries from the framework. When I install and launch the application on end user machine the icons are not visible, not loaded.The problem is that I have the icons visible only at the machine (OS) where I compiled and built the application and when putting the .exe file with needed .dlls(QtGui4.dll, QtCore4.dll,mingw10.dll,libgcc_s_dw2_1.dll) on the end user machine ( installation) the icons are not visible,not loaded.
I have tried to use external binary resources ( I’ve compiled .qrc file with rcc and putted QResource::registerResource(…) ) and also I have tried compiled in resources and also tried to put icons from separate files. I made all the needed according to Qt Reference Documentation – the Qt Resource System. My icons are added to to .qrc resource file.
But I see icons when I launch the application only at machine where I build the application and the icons are invisible when installing on end user machine. I build for Windows XP, 7. I also tried to install on end user machine the Qt SDK and copied my .exe file and .rcc file to directory ../Qt/2010.05/qt/bin, in such a case the icons are visible(loaded). But I don’t need the users(clients) installs something else and heavy besides my .exe file and .dlls of Qt you understand.
Please help, advise what is the problem with icons ( resources ), when you will help me I’ll help you too from my experience with Qt.
Pavel.

high_flyer
18th February 2011, 10:08
Make sure that you add the image qt codecs plugins that correspond to your icons (jpg svg etc) along with the other qt dlls.

elettronik
18th February 2011, 10:11
Also check that resources are compiled into exe

freely
18th February 2011, 11:14
Hi
Thank you for your replies
How can I check that resources were compiled to exe?
If I see icons when I launch the application on the developer machine does not that say that resources were compiled?

About plugin:
What is a plugin? Where can I get it?
No In Qt Reference documentation - Qt Resource system there is no word about need in any plugin
Standart SDK is enought?

Added after 12 minutes:

So what does it mean?
That I can't compile my application ones and install ( deploy ) on another machines with needed windows dlls with the icons seen?
I begin to think the Qt developers make this so as not to make possible to redistribute made programs under GPL?

freely
18th February 2011, 11:15
So what does it mean?
That I can't compile my application ones and install ( deploy ) on another machines with needed windows dlls with the icons seen?
I begin to think the Qt developers make this so as not to make possible to redistribute made programs under GPL?

high_flyer
18th February 2011, 11:21
How can I check that resources were compiled to exe?
A cpp file with the qrc file prefix should be compiled as part of the project.


What is a plugin? Where can I get it?
look under QTDIR\plugins\codecs

high_flyer
18th February 2011, 11:31
Please don't multi post.
Merging.

freely
18th February 2011, 11:41
Hi
The resources were compiled to exe sure there is coded images as hexadecimal numbers in .cpp file

Regards codecs... perhaps it is the problem? I will check the plugins, but No - so Why when I deploy exe to ../Qt/2010.05/qt/bin the icons are visible?

Added after 4 minutes:

I have tried also to deploy with dlls from plugins/codecs , plugins/imageformats, plugins/iconengines but still I can't see icons
I can see only when I install full Qt SDK and I deploy to qt/bin directory
But we understand the end user should not install full Qt SDK so as to use application
why such a problem?>

high_flyer
18th February 2011, 11:55
Are the Qt Dlls and your exe in the same folder?
If not, you need to set the environment path as well.

freely
18th February 2011, 12:00
Sure My dll's and exe and all files are in one bundle(folder)

sure dll's for the application, .exe, application service files installed in one folder to HDD to end user, the application is succeed to launch but icons not visible in places that I have included them

high_flyer
18th February 2011, 12:48
Do you have the following line in your pro file:
RESOURCES = <you_resource_filename>.qrc

Also, can you post one example line from your code, where you are accessing an image?

freely
19th February 2011, 14:45
Hi
Yes, sure
the dlls, exe are in one folder, installed at end user machine to one folder
I have added resources in .pro and also " registered " in main.cpp as it is explainded in Qt reference documentation

Here is the example of image including from file generated by .uic after I've added icons in Qt Designer:



QIcon icon1;
icon1.addFile(QString::fromUtf8(":/Icons2/Tell a Friends.ico"), QSize(), QIcon::Normal, QIcon::Off);
actionTell_a_friend->setIcon(icon1);
actionContact_us = new QAction(MainWindow);
actionContact_us->setObjectName(QString::fromUtf8("actionContact_us"));
QIcon icon2;
icon2.addFile(QString::fromUtf8(":/Icons2/Contact Us.ico"), QSize(), QIcon::Normal, QIcon::Off);
actionContact_us->setIcon(icon2);
actionQuit = new QAction(MainWindow);
actionQuit->setObjectName(QString::fromUtf8("actionQuit"));
...

schnitzel
19th February 2011, 18:15
your app should be deployed like this:

<app>.exe
dlls that you listed before
imageformats\qico4.dll

hope this helps

high_flyer
20th February 2011, 11:48
Try renaming the icons to not include spaces.

freely
20th February 2011, 14:59
hey!
Thank you very much
Yea I try today to deploy with imageformats and iconengines dlls
I fill it succeed!
:cool:

Thank you shnitzel
you understand!

freely
21st February 2011, 11:54
Hello
I deployed today with /plugins/imageformats folder
It works only when I deploy may application exe, main Qt dlls and imageformats folder on windows
How can I deploy on MacOS, Ubuntu, Symbian , Maemo?
Thanks
Pavel

freely
28th February 2011, 09:34
Thank you all
I succeed to intstal the application with icons

http://www.realvirtualdevelopment.co.nr

Pavel