. Qrc file in QT

Source: Internet
Author: User
Tags qt designer

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 "));).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.