Create Qt resource collection files
The Qt Resource System is a platform-independent mechanism for storing files in the application's executable. Use it if your application always needs a certain set of files (like icons, translation files, images), and you don't want to use system-specific means to package and locate these resources.
You can create and edit Qt resource collection (.qrc
) files.
Create QRC files
To create a new QRC file:
- Go to Command Palette, and then select Qt: Create a new project or file.
- In File, select Qt resource file.
- In Name, enter a name for the file.
- In Create in, enter the path for the file.
- Select Create to create the file.
Edit QRC files
Add groups with different prefixes to structure the resources and avoid clashes between resource files that you add through different .qrc
files in different libraries or plugins.
Sometimes it is convenient to make a resource file available under a different path at runtime. .qrc files allow this by setting an alias
attribute.
To edit a QRC file:
- Open a
.qrc
file. - Select Files to add files to the group.
- In Alias, set the path where the resource file is available at runtime.
- In Prefix, set a prefix to add to each local file name to get the name by which the file is known within the resource system.
- In Language, set a suitable locale string to select resources, such as translation files or icons, based on the user's locale.
See also Tutorial: Qt Widgets application and Create Qt projects.
© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.