Qt Reference Documentation

Application Icon Example

The example shows how to add an application icon to a mobile application.

The icon on a Nokia XPressMusic 5800

Creating an icon for Maemo

Maemo expects the icon of an application to be a 64x64 PNG image file. The file name of the icon should be the same as the executable with a .png extension. You also need a .desktop file that gives the window manager hints about the application, such as name, type and icon.

 [Desktop Entry]
 Encoding=UTF-8
 Version=1.0
 Type=Application
 Terminal=false
 Name=Application Icon
 Exec=/opt/usr/bin/applicationicon
 Icon=applicationicon
 X-Window-Icon=
 X-HildonDesk-ShowInToolbar=true
 X-Osso-Type=application/x-executable

The Icon field should also contain the name of the executable. On the device, application icons are stored in the /usr/share/icons/hicolor/64x64/apps directory and desktop files in the /usr/share/applications/hildon directory.

Adding the icons to the project

For Maemo, we need to add that the .desktop and icon file should be installed.

 QT       += core gui widgets

 TARGET = applicationicon
 TEMPLATE = app

 SOURCES += main.cpp

 OTHER_FILES += applicationicon.svg \
                applicationicon.png \
                applicationicon.desktop

Currently, Qt Creator doesn't include the icon and desktop files in the application package for Maemo, merely the executable file is included. As a workaround for this, the files can be added manually in the Projects tab. In the "Create Package" build step for the Maemo target, the .desktop file and icon can be added to be a part of the package contents. Unfortunately, these additions are only stored as a part of the .pro.user file. This issue will be resolved in a future release of Qt Creator.

Manual addition of files to the "Create Package" build step