Qrc file in QT
Is a resource configuration file in XML format, with the ApplicationProgramThe associated application is specified by the. qrc file. It uses XML to record the files on the hard disk and the corresponding randomly-specified resource name. The application uses the resource name to access the resources.
The specified path is the relative path of the directory where the. qrc file is located. Note: The listed resource files must be located in the directory or subdirectory of The. qrc file.
The icon file must be in the same directory or subdirectory as the qrc file. In addition, if the qrc file uses a prefix (for example, <qresource prefix = "/myresources">), ensure that the icon path is correct; when you use QT designer to add an icon file, the prefix/New/prefix is automatically used, but this path does not exist by default.
In most applications, the resource path can be used to replace the original file system path. In particular, you can pass the resource path in the qicon, qimage, or qpixmap constructor to replace the file name:
Cutact = new qaction (qicon (":/images/cut.png"), TR ("Cu & T"), this );
How to Create a qrc file in qtcreater:
Add a new file-QT resource file
You can edit it in multiple ways. When editing it in the resource editor, you must first setPrefix, That isRelative Path under the qrc File,If the qrc file is in the same folder, you only need to set the prefix /.. ThenAdd the files you need in the configured path., InReferenceOnlyUse: SymbolYou can (such as newaction-> seticon (qicon (":/filenew.png "));).