C
ImageFiles.MCU.base
定义资源的基路径。
说明
基路径决定了计算出的资源 URI 的锚点。当使用通过“files”或“directory”属性定义的资源时,路径中将省略基名,如下例所示。
用法
该属性可在主应用程序的.qmlproject 文件或模块的.qmlproject 文件中使用。它接受字符串参数。
代码示例:
# In myproject.qmlproject file
ImageFiles {
// Specify the base image paths declared in the current node
MCU.base: "images"
files: ["images/small/foo.png", "pics/small/bar.png"]
}
# In CustomItem.qml
Image {
id: image1
source: "/small/foo.png" // The base "images" is not included in the source path
}
Image {
id: image2
source: "/pics/small/bar.png" // image2 is not in images, "base" has not effect
}由于
该属性是在 QmlProject API 1.3 中引入的。
在某些 Qt 许可证下可用。
了解更多。