[Qt-interest] Unable to use .rc file for application icon.

Oliver.Knoll at comit.ch Oliver.Knoll at comit.ch
Wed Jul 29 11:19:43 CEST 2009


bharath.narayan at nokia.com wrote on Wednesday, July 29, 2009 10:34 AM:

> ...
> 1. Will this work on Linux also? (and other platforms) - If no then
> how do I make it work the same. (I understand that the icons are
> different in various platforms). 

On Linux (and other platforms) "assigning an icon to an executable" is different than on Windows. The data specified in the *.rc file is "compiled into the executable", and Windows then knows how to display that icon, in the Explorer for example. So the whole *.rc concept is Windows specific.

Nowadays most Linux desktop (KDE, Gnome) are also able to read the *.ico format, but the preferred format is probably *.png (for pixel-based icons. AFAIK KDE/Gnome also support SVG, i.e. vector-based icons).

That said, how an icon is associated with an "exectuable" (binary file, shell script, ...) is desktop dependent (and different than what Windows does, see above), but I think KDE/Gnome share the same mechanism. There are *.launch (?) files generated which specify the location in the "start menu", the application icon, what files are associated with that application etc. - or something along that line.

Here is an URL which might serve as a starting point:
  
  http://goinglinux.com/articles/DesktopLaunchers.html
 
> 2. Is there any free tool to generated the icons. (the one below is a
> commercial). 

To some extend http://www.gimp.org can help you - it can read/write *.ico files, even with "multi-resolution" (e.g. you can embed 16x16, 32x32, 48x48 etc. versions of your icon into the *.ico file. Not sure whether Gimp also supports different colour resolutions in one *.ico file (1 bit, indexed colour, 8bit ("True Colour")).

Then there is http://www.imagemagick.org which is a command-line based tool (as well as a image manipulation library). It can read/write dozens (if not hundred+) file formats. Might be that you can embed multiple image files (e.g. given in PNG format) into one single *.ico file.

Cheers, Oliver
-- 
Oliver Knoll
Dipl. Informatik-Ing. ETH
COMIT AG - ++41 79 520 95 22



More information about the Qt-interest-old mailing list