How to have a custom icon for my application.exe/executable QT, i used Visual Studio 2019
-
I wanted to have a custom icon for my application.exe executable , i have also tried referring this documentation https://doc.qt.io/qt-5/appicon.html, but i didn't use QT-Creator to create my project,so i don't have the .pro file to make any changes, i have used Visual Studio 2019 to work on my project and complete it.
How can i set a custom icon when i used Visual studio 2019 ?
-
@learnist said in How to have a custom icon for my application.exe/executable QT, i used Visual Studio 2019:
ut i didn't use QT-Creator to create my project,
So what do you actually use?
You have to create a .rc file - no matter what build system you're using. See e.g. here: https://forum.qt.io/topic/81519/how-to-set-the-application-icon-on-windows-using-cmake -
@Christian-Ehrlicher i can definately create a .rc file but how to add it in pro file, i dont have .pro , right ?
-
If you don't use a pro file or CMake script you have to add it by your own similar you're calling e.g. uic or moc - see the msdn documentation.
-
Actually, this question is not Qt-related. It works for Qt as for any other software not using Qt. I, personally, don't know how to setup VS2019 properly to do this. What you could try, though, is to make a small dummy qmake project, set
RC_ICON
appropriately, compile it and have a look at the makefile. If your .pro-file hasTARGET=MyProject
, qmake will generate aMyProject_resource.rc
. This needs to be compiled with Visual Studiosrc
resulting in a.res
-file. I guess, this is then just linked in. At least this is the way qmake does it and you can take the steps from its makefile.