Friday, October 16, 2009

Application Icon on Windows

So you've written a cool Windows app using Qt - but hey, it doesn't have an icon! Well, adding one is quite easy.

Simply create a special resource file that contains a reference to the .ico file that you want to use and then add a RC_FILE entry to your .pro file. The resource file usually has a .rc extension, and will look something like this (e.g. MyApp.rc):

IDI_ICON1 ICON DISCARDABLE "path/to/an/icon.ico"

The .pro entry that points to this file should be win32 specific:

win32:RC_FILE = MyApp.rc

Rebuild and hey presto! a nice Windows icon for your app.

You can also give your Linux/Mac applications an icon. More info on this can be found here:

1 comment:

  1. Presto Shmesto, this is what you get:

    C:\dev\myapp\myapp-debug\..\resources\win32\win32.rc:1: error: RC2176 : old DIB in myIcon.ico; pass it through SDKPAINT