C

ImageFiles.MCU.prefix

Adds a common prefix to the image asset URI.

Description

The prefix node adds a common prefix to the URI that's used to access the assets.

Usage

This property is accepted in the main application .qmlproject file, or a module .qmlproject file. It takes a string.

Code example:

# In myproject.qmlproject file
ImageFiles {
    // Specify the prefix for images declared within the current node
    MCU.prefix: "assets"
    files: ["map/small.png"]
}

# In CustomItem.qml
Image {
    id: image
    source: "/assets/map/small.png"
}

The property base can be used in combination with prefix.

Note: The prefix is still added to the URI even if the base is not found.

# In myproject.qmlproject file
ImageFiles {
    // Specify the prefix for images declared within the current node
    MCU.base: "photos"
    MCU.prefix: "pictures"

    files: ["photos/hires/house.png", "map/small.png"]
}

Image {
    id: image1
    source: "/pictures/hires/house.png"
}

Image {
    id: image2
    source: "/pictures/map/small.png"
}

Since

This property was introduced in QmlProject API 1.3 .

Available under certain Qt licenses.
Find out more.