include_bytes_qml!() { /* proc-macro */ }Expand description
Includes a file or a directory and makes it accessible under the Qt resource system.
The path is resolved relative to the source file in which the macro is invoked, similarly to Rust’s [include_bytes!] macro.
If the path refers to a directory, all files in that directory and its subdirectories are included recursively while preserving their relative paths.
An optional prefix can be added as a second macro parameter.
§Examples
Including a single file:
ⓘ
fn main() {
include_bytes_qml!("images/icon.png", "resources");
}Including a directory:
ⓘ
fn main() {
include_bytes_qml!("images", "resources");
}This makes the file images/icon.png, relative to the source file containing
the macro invocation, accessible in QML as qrc:/resources/images/icon.png
or :/resources/images/icon.png.
Image {
source: "qrc:/resources/images/icon.png"
}