Qt World Summit: Register Today!

Set exe icon from qrc using Visual Studio

  • Hi,

    i know there is a easy way to set the application icon from qrc using QtCreator. But i'm working on Visual Studio using the Qt Addon. Does anyone knows how it works that way??

  • Moderators

    qrc is Qt's resource format. The data is translated into static c++ binary array. OS knows nothing about this mechanism so it's not true you can set it up in Qt Creator. You're probably thinking about the qmake's RC_ICONS, but that has nothing to do with Qt's qrc resources. It's just a platform independent shortcut for whatever needs to be done.

    On Windows, particularly in Visual Studio, "what needs to be done" means creating a whatevername.rc file, adding it to the solution, inserting a line similar to this into it (adjust the file name of course):

    IDI_ICON1               ICON    DISCARDABLE     "myappico.ico"

    and compile it. You can also use the "right click on the project node->add->resource->icon" wizard, but be aware that it somewhat bloats the resource file, when all you need is the above line.

    Oh, and be sure to check the docs for more info: Setting the Application Icon.

  • @Chris-Kawa thank you :D

Log in to reply