There are many ways to add icons to QT applications, here are two commonly used ones:
-
Method 1: Generate a makefile through qmake to realize the process
1) Find a picture .ico and change the name to myappico.ico;
2) Create a new text document, add IDI_ICON1 ICON DISCARDABLE "myappico.ico" inside, and rename the file Is myapp.rc;
3) Add RC_FILE = myapp.rc at the end of the myapp.pro file, after regenerating, the modification is successful -
Method 2: The
first two steps are the same as those of method 1, the last step is to load the .rc file into the project, right-click the project-add-existing file, and right-click the .rc file after adding After compiling and regenerating the executable file, the modification is successful.