atman
atman

Reputation: 197

Set icon for Qt application built in Visual Studio

I have a Qt application that I've made in Visual Studio however I can't figure out how to create the executable (on windows) with a specific icon instead of the default windows executable icon. Anyone know the simplest way to do this using visual studio or something else?

Edit - In addition to the answer below this is what I had to do step by step:

Upvotes: 1

Views: 1407

Answers (1)

Joel Bodenmann
Joel Bodenmann

Reputation: 2282

I don't know whether this is the Qt-offical way of doing things but this is what works for me:

  1. Create a *.ico file of whatever you want to use as a logo. I called mine favicon.ico.
  2. Create a file named yourapplication.rc.
  3. Add the following line to yourapplication.rc: IDI_ICON1 ICON DISCARDABLE "favicon.ico".
  4. Add the *.rc file to your buildsystem as a source file.
  5. Make sure that your *.exe ships along side the favicon.ico file.

Edit: Official Qt5 documentation on this: https://doc.qt.io/qt-5/appicon.html

Upvotes: 3

Related Questions