QT adds the program icon and window icon, and qt adds the icon window
Program icon material preparation
Icon file: *. ico file, which is stored in the same directory as the source file, for example, "myapp. ico"
Write icon
Write "RC_ICONS = *. ico" into an independent row in the *. pro file, such as RC_ICONS = "myapp. ico"
Generate a program
Run the program to view the software with icons under the program directory.
PS: there is also a method to use rc files. I wrote a blog post which is quite detailed. It is no longer cumbersome here. Refer to Qt notes-set the Qt application icon in three steps.
To add more program icons, enter "Setting the Application Icon" in the help box"
Window icon material preparation
Icon file: A common image file can be stored in the same directory of the source file or in a new folder.
Generate a QRC File
Right-click the project and select "add New... ", in the new window, select" QT-> Qt Resource File-> Choose... ", enter the file name (random), next, and finish.
Import images
Right-click the generated qrc File, select "Open in Editor", add Prefix (any name), add File, and select the image File.
Set window icon
Edit the ui file in the window, find the "wicon" Property in the property bar, select "Choose Resource...", and find the icon to be used in the new window.
Running to see the effect
Blog posts are for reference only. For more information, please advise.
References:
Qt notes-set the Qt application icon in three steps
QT program icon and window icon