PDA

View Full Version : Application icon from .qrc file



cia.michele
5th May 2010, 08:02
Hello to everybody,
I'm a newbie with QT, and while I try to compile my application, I saw this strange behavior (strange, probably only for me).
I can configure, by mean of .qrc (QT Resource file) all the images, and icon for my application, and find them by resource path (:/prefix/files) but... How can I set the application icon (the icon of .exe executable)?
Looking up on-line documentation, i found a guide that explain the use of a .rc files, in which i should describe the icon and add this to the .pro file. I try it, it work fine, but, why It is necessary? Is it impossible take the application icon from the .qrc file, so the .qrc file substitute completely the .rc file? If no, why?

Thanks for your answers.

Michele

ChrisW67
5th May 2010, 09:31
It is Windows (in this case) that is looking at the executable and extracting the icon to display in the Start Menu or on the Desktop. Windows does not know anything about the internals of a Qt program, so it cannot be expected to find a Qt resource buried in the executable. The Windows resource file and compiler attaches resources to the binary in a way Windows can access.

Other operating systems use icon files external to the application.

cia.michele
5th May 2010, 16:54
Thanks Chris for your answer.
I imagined something like this, but I thought that there is a way to generate automatically the .rc file from the .qrc file.
Is there somthing like this? If there isn't, no way, I'll use the .rc file only for Application Ico.

Thanks a lot

Michele

ChrisW67
6th May 2010, 02:06
There's nothing I'm aware of that does this. There's much more than just an application icon that can go in the Windows RC file: version resources (look at file properties/version), localised names etc. Qt does make some allowances for the Windows resources: it adds resources when using ActiveQt and can generate a manifest file to be included when using Visual Studio.