This post shows How to set an application icon in a QT project into a Qt implementation. -For any sort of internal file that wants to be embedded in an executable, the strategy maintains a picture (icon), with assistance, etc.
The issue will be proved on an application-embedded icon icon.png. We need to take the following measures in the Qt Creator to accomplish the embedding:
When you are building an application in qt, then you have noticed that your application.exe has no icon in it.
Requirement of How to set an application icon in a QT project:
- A Qt project without any compilation error
- A icon file(any format), Recommended using .ico file format
Note: if you have any trouble in the compilation of your QT project then check Basic compilation error from here.
Steps to set an application icon in a QT project:
1- Get the icon file and place it in the root directory of your project. In my case it is icon.png format. So you have to convert it into .ico file.
Note: Skip step 2 if you already have file .ico file
2- Convert your icon.png to icon.ico file from online file converter here.
3- Now put icon.ico file into the root directory in your project. In my case, I put it in lyric pad-master Directory
You might like: How to deploy QT Application for Windows.
4- Now open your application.pro file in QT, and paste the code snippet given below:
RC_ICONS = icon.ico
Note: In my case file name is ‘icon’, you should rename icon.ico file to [your-file].ico
5- That’s all! Now build your project in the debug mode inside qt and you will see a shiny icon is embedded with your application.
In my case, I have made a lyricpad application for windows. Now its become very popular nowadays. You can get it from here for Ubuntu.
If you have any query/problem then please comment below!