How to set application icon in a Qt-based project?

Viewed 96006

How do you set application icon for application made using Qt? Is there some easy way? It's a qmake-based project.

5 Answers

To extend Rob's answer, you can set an application icon for macOS by adding and modifying the following line onto your .pro file.

macx: ICON = <app_icon>.icns

Note that the ICON qmake variable is only meant to target macOS.

For Windows, use

  • RC_ICONS = <app_icon>.ico if you're attaching a .ico file
  • or RC_FILE = <app_icon>.rc if you want to attach your icon through a .rc file. (Be sure to add IDI_ICON1 ICON DISCARDABLE "myappico.ico" into the rc file. Indentation not mine.)

For further reading, see Setting the Application Icon.

Related