Macro qt_core::q_init_resource
source · macro_rules! q_init_resource { ($($proc_macro:tt)*) => { ... }; }
Expand description
Initializes Qt resources specified by the .qrc
file with the specified base name.
This macro should be used in combination with qt_ritual_build::add_resources
.
Call add_resources
in the build script of your crate, then call the macro like this:
QGuiApplication::init(|_| unsafe {
q_init_resource!("resources");
//...
})
The argument must be equal to the base name
(file stem)
of the .qrc
file. Special characters (such as ‘-’)
have to be replaced by the underscore character ('_'
).
This macro is semantically equivalent to the Q_INIT_RESOURCE C++ macro.
Initializes the resources specified by the .qrc file with the specified base name.
Normally, when resources are built as part of the application, the resources are loaded
automatically at startup. The Q_INIT_RESOURCE()
macro is necessary
on some platforms for resources stored in a static library.
For example, if your application's resources are listed in a file called
myapp.qrc
, you can ensure that the resources are initialized at startup
by adding this line to your main()
function:
Q_INIT_RESOURCE(myapp);