Getting Started with QT Creator - Note 2 - Adding Icons to Windows and Applications

Question 2 Add icons to windows and applications to add icons

Reference blog http://blog.chinaunix.net/uid-20044771-id-3218453.html


Add application icon


Prepare:

1. Icon file: ICO icon file
2. Resource file: RC file
Note:
These two files should be placed in the same path as the project file (*.PRO)
A good icon download website http://www.easyicon.net/
An online ICO file conversion website http://www.ico .la/

steps:
1 Write an RC file with Notepad:

Create a new file with Notepad and write IDI_ICON1 ICON DISCARDABLE "xxx.ico"

Note: xxx.ico is the icon file name

Save as xxx.rc file


2. Modify the content of the project file (*.pro)

Add the following line at the end of *.pro
  1. RC_FILE += xxx.rc
Note: xxx.rc is the resource file name

3. Compile and run
After build, you can see that the ICON of the corresponding exe executable has changed in the debug or release directory.

window icon

Prepare:

Icon file: BMP/PNG image can be used


step:
1. Create a QRC file
The QRC file should be a QT resource file, which can be created by right-clicking "Add New" under QT Project

2. Edit QRC and add pictures
a. First add the prefix (prefix)

b. Then add the file (file)

3. Modify the windowsicon item
Open dialog(*.ui) and find the windowIcon item

Select Resource


4. Compile and run, look at the changes in the upper left of the window













Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325890791&siteId=291194637