Adding new resources to a Qt project is similar to adding resources to a normal C++ project. The main difference is that
.qrc files (Qt resource files) are used instead of Windows
.rc files. Unlike
.qrc files work on all platforms supported by Qt and are trivial to load from Qt code.
To add new resources:
- Select Project > Add New Item > Installed > Visual C++ > Qt > Qt Resource File.
- In the Name field, enter a name for the resource file.
- In the Location field, specify a location for the file.
- Select Add to create a
.qrcfile and to open it in the Qt Resource Editor.
- To add resources to the file, select Add > Add Files.
- In the Prefix field, you can change the prefix.
When referring to the resources later on from Qt code, you must prepend the prefix, the file name, and a colon. For example,
To add prefixes to the
.qrc file, select Add > Add Prefix in the Qt Resource Editor.
For more information, see The Qt Resource System.
© 2016 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.