On this page

Qt.qml

Provides Qt QML support. More...

Properties

Detailed Description

The Qt.qml module provides support for the Qt QML module, which contains classes for QML and JavaScript languages.

Note: If the current value of qbs.architecture is not supported by qmlcachegen, the QML cache file generator rule is disabled.

Relevant File Tags

TagAuto-tagged File NamesSinceDescription
"qt.qml.js"*.js1.10QML companion JavaScript files. Source files with this tag serve as input for the QML cache file generator.
"qt.qml.qml"*.qml1.8Source files with this tag serve as inputs to the QML plugin scanner.
"qt.qml.types"n/a1.16This tag is attached to the files created by the qmltyperegistrar tool if the importName property is set.

See also Qt.quick and Qt.declarative.

Property Documentation

cacheFilesInstallDir : string

The path to the directory where the cache files are installed.

If this property is set, QML cache files are automatically installed.

Default: Undefined


[read-only] cachingEnabled : bool

This property is true if generateCacheFiles is true and the platform supports QML cache generation.

Default: false


[since Qbs 1.16] extraMetaTypesFiles : stringList

Specifies extra metatypes files to pass to the qmltyperegistrar tool via the --foreign-types option when registering QML types.

Note: This property is only needed for external libraries, not products or modules pulled via Depends items. In particular, you don't need to (and should not) use it to collect the metatypes files of Qt modules. These are found automatically. This property has no effect if importName is not set.

Default: Undefined

This property was introduced in Qbs 1.16.


generateCacheFiles : bool

Whether QML cache files are generated.

Default: false


[since Qbs 1.16] importName : string

Setting this value triggers QML type registration via the qmltyperegistrar tool, which results in the creation of a file with the tag "qt.qml.types". The given string is the name under which the registered types can be imported by QML code that wants to use them.

Note: This functionality is only available with Qt 5.15 or later.

Default: Undefined

This property was introduced in Qbs 1.16.


[since Qbs 1.16] importVersion : string

Specifies the version of the types to be registered. Values consist of a major and an optional minor number, separated by dots. This property has no effect if importName is not set.

Default: The product version

This property was introduced in Qbs 1.16.


[since Qbs 3.4] loadedAtRuntime : bool

Controls whether the generated qmldir contains a plugin line (and, if pluginClassName is set, a classname line).

The default value already matches the expected behaviour in most cases: true for dynamic and loadable-module products so the QML engine can discover and load the plugin at runtime, and false for static libraries where no dynamic loading takes place.

The one case that requires an explicit override is a dynamic library that is linked directly into the application at build time. In that case set this property to false so that the QML engine can adapt its run-time behavior accordingly.

This property has no effect if importName is not set.

Default: true for dynamic and loadable-module products, false for static libraries.

This property was introduced in Qbs 3.4.


[since Qbs 3.4] pluginClassName : string

The C++ class name of the QQmlExtensionPlugin subclass.

When loadedAtRuntime is true and this property is set, a classname line is written into the generated qmldir. The QML engine uses this name to instantiate the plugin object after loading the plugin library at runtime.

This property has no effect if importName is not set.

Default: Undefined

This property was introduced in Qbs 3.4.


qmlCacheGenPath : string

The absolute path to the qmlcachegen executable.

Default: Determined by setup-qt.


qmlImportScannerName : string

The base name of the QML import scanner.

Set this value if your system uses a name different from the default value.

Default: "qmlimportscanner"


qmlPath : string

The absolute path to the directory where Qt's QML files are installed.

Default: Determined by setup-qt.


[since Qbs 3.4] qmldirInstallDir : string

The directory where the generated qmldir file is installed. If empty or undefined, the file will not be installed.

This property has no effect if importName is not set.

Default: Undefined

This property was introduced in Qbs 3.4.


[since Qbs 1.16] typesFileName : string

Specifies the name of the file that declares the types registered for this product. For applications, the default value is <name>.qmltypes, where <name> is the product's target name. Otherwise, the default value is "plugins.qmltypes".

Note: The naming conventions are still in flux. When in doubt, consult the Qt documentation.

This property has no effect if importName is not set.

This property was introduced in Qbs 1.16.


[since Qbs 1.16] typesInstallDir : string

The directory to install the qmltypes file into. If this property is empty or undefined, the file will not be installed. This property has no effect if importName is not set.

Default: Undefined

This property was introduced in Qbs 1.16.


© 2022 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.