1 using resource files in programs
A a QT Empty Project
B Right-click the project and add a new file
The effect after adding is
C Right-click MAIN.PRC, Select Add Existing item to locate the resource file you want to use. The end result is:
D Use QRC file
T27resource.pro |
RESOURCES+= \ MAIN.QRC SOURCES+= \ main.cpp QT+= gui widgets |
Main.cpp |
#include<QApplication>
#include<QLabel>
#include<QPixmap>
intmain(intargc,char* * argv)
{
Qapplicationapp (ARGC,ARGV);
// when referencing a file, add the following sentence
Q_init_resource (main);
Qlabellabel;
// when using a resource file, precede with a colon
Label.setpixmap (qpixmap(":/aaa.png"));
Label.show ();
returnapp.exec ();
}
|
The results are as follows: |
2 Program Packaging
installation Inno Install package
Start the setup process below
Click File--> New
Until the end.
When you are finished writing, you can click Build à compile, you can then output it in the specified directory. EXE file
Using resource files in 2.QT, program packaging