Skip to main content

Module qresource

Module qresource 

Source
Expand description

This module contains functions for importing artifacts from the Qt Resource System.

All artifacts must be compiled into dynamic resources with the rcc tool:

rcc -binary [more options] <inputs>

before or at compile time. The input for the rcc tool are Qt Resource Collection (*.qrc) files, that contain lists of all files to be imported.

<RCC>
    <qresource prefix="/">
        <file>images/copy.png</file>
        <file>images/cut.png</file>
        ...
    </qresource>
</RCC>

Dynamic resources can be registered with register_bytes and are then available at runtime through the qrc:/ scheme in QML:

Image {
    source: "qrc:/images/copy.png"
}

We further provide the include_bytes_qml macro that generates the required dynamic resource directly in Rust at compile time.

Functionsยง

register_bytes
Registers Qt resource data from an in-memory byte slice, making embedded resources available at runtime through the qrc:/ scheme.
register_bytes_with_prefix
Registers Qt resource data from an in-memory byte slice under resource_root, making embedded resources available at runtime through the qrc:/ scheme.