PDA

View Full Version : Distributing an application with resources



ntp
4th October 2007, 19:36
This is for windows but I'll need to do the same for Linux eventually.

I've created an application that has resources using Compiled-In Resources. I have a myResources.qrc file and I create my images using code like:


m_stopInputAction->setIcon(QIcon(":/stop.gif"));


In my main.cpp, I have:


QApplication app(argc, argv);
Q_INIT_RESOURCE(myResources);


This works fine on my machine. I copied the executable and all the dlls from my qt/lib directory over to another machine and put them into one directory. When I ran the program, everything came up except the icons. I tried copying over the myResources.qrc file also but that didn't help.

Is there a step that I am missing?

Thanks.

marcel
4th October 2007, 19:53
Its the gif plugin. Search the forums.
I think you have to copy them in the plugins/imageformats directory on the target machine.

ntp
5th October 2007, 19:32
I found the image dlls (qgif4.dll, etc) under
C:\Qt\4.3.1\plugins\imageformats

and then needed to make a ".\imageformats" directory where the executable is and put the dlls in that.

It doesn't appear that I need a qt.conf file in case anyone else runs into the same problem.

This link wasn't that much help except that it showed me how to cut down on the dlls I was copying by using the depends tool (but it doesn't cover the image dlls)

http://doc.trolltech.com/4.3/deployment-windows.html#application-dependencies

p.s. unfortunately, I couldn't search for "gif" in the forums - the search mechanism rejected it as being too short.

Brandybuck
6th October 2007, 01:46
An alternative solution is to abandon GIF. The PNG image format is supported by everyone, and it's not a plugin. It's perfect for icons.