C

MCU.Config.fileSelector

A list of strings, specifies which variants to use by default for nodes in the qmlproject file.

Description

You can use the fileSelector property when the project has many files with the same name and purpose, but its contents vary depending on the selected device characteristics (screen size, platform, languages etc.), and the project uses each file for a specific set of characteristics.

qmlprojectexporter uses it to keep the reference to the file the same across all variants.

In a qmlproject, you can set this property at different levels as listed below, qmlprojectexporter gets the selector's value following the same order

  • In files nodes (QmlFiles, ImageFiles, FontFiles ModuleFiles and TranslationFiles) through the "fileSelector" property
  • In the MCU.Config node using "fileSelector" property, this will apply to all the nodes in the file that does not have "fileSelector" defined.
  • Using the qmlprojectexporter --selector option, you can use this to configure the whole project, and qmlprojectexporter applies the selectors to all .qmlproject files used in the project (main file and the imported modules)
  • Lastly qmlprojectexporter can use default QFileSelector selectors in the project.

Note: The possible selector values depend only on folder names in the project (QFileSelector considers folders that start with + to be a selectable variant)

Note: It is possible to chain selectors "project/+selector_one/+selector_two/resource.png"

Warning: You should place selectors at the end of the resource path. QFileSelector will ignore any selector in the middle and will only consider them as a normal folder. For example "project/+wrong_selector/normal_folder/+correct_selector1/+correct_selector2/resource.png"

Usage

This property is accepted in the main application .qmlproject file, or a module .qmlproject file. It takes a list of non-empty strings.

Code example:

// Project files:
//      data/images/+big/logo.png
//      data/images/+small/logo.png
//      src/headers/+ram_optimized/myoperation.h
//      src/headers/+cpu_oprimased/myoperation.h

// Picks src/headers/+ram_optimized/myoperation.h
//      data/images/+small/logo.png

MCU.Config {
    fileSelector: ["ram_optimized", "small"]
}

InterfaceFiles {
    files: ["src/headers/myoperation.h"]
}

ImageFiles {
    files: ["data/images/logo.png"]
}

Since

This property was introduced in QmlProject API 1.3 .

Available under certain Qt licenses.
Find out more.