Qt icon built into Executeable

I have several buttons on a tab. These buttons should have an icon above them.

I know QPixmap, which will allow me to put the image on top of the button, but I see that these constructors take the file path as a parameter. I want to avoid dragging and dropping the icons into the file after the build. I would like to somehow embed these icons in an executable file in order to reduce the luggage that I need so that it can be tricked to make it work.

How can i do this?

I am interested in hearing how to accomplish my task: no need to drag and drop icon files with an executable file; please focus on this aspect if you are confused about some terminology that I may have used since I am still learning Qt.

+5
source share
2 answers

Of course, you can insert icons, images, and all other user resources into the application. Please read the Qt 4 Resource System (or click here for Qt 5)

+12
source

, ProjectName.qrc, ( PNG). Qt Creator QRC . "" ":/Images/MyCrazyIcon.png", , . , Qt , , ; , , . , , (, "MyBigFile.png" ":/MyBigFile.png", ).

":", ": MyFile.png", QRC , , . . ".../Images/...", ": MyPic.png" ":/Images/MyPic.png" .

Qt , , Windows Mac, . , " " , , , . QRC . . Qt , Windows, Mac. . . , .

+4

All Articles