- Qt 6.12
- Qt Qml
- Qt Qml Tooling
- Deploying QML Applications
- Qt 6.12.0 Reference Documentation

QML type compiler ◦ qmllint

# Deploying QML Applications

This page provides information on how to deploy QML applications. It covers the use of Qt Creator for deployment, and the use of the Qt Resource System to package QML files and other resources with the application executable.

## Deploying applications with Qt Creator

Qt Creator deploys and packages QML applications to various platforms. For mobile devices, Qt Creator can directly bundle applications to the respective platform package formats, such as APK.

When you run your applications on the target platform, your application needs to access the location of the QML libraries. If you use qmake, the `QT_INSTALL_QML` environment variable points to the location of the libraries. The Qt Installers install the QML libraries in: `<version>``/`<compiler>`/qml` directory.

## Using the Qt Resource System with QML

The Qt resource system allows resource files to be stored as binary files in an application executable. The Qt Resource System is used for QML application as it enables QML files and other resources – such as images and sound files – to be referred to through the resource system URI scheme rather than relative or absolute paths to filesystem resources.

Note: Usage of the resource system means that the application executable usually must be re-compiled whenever a QML source file is changed, to update the resources in the package.

The CMake QML Module API automatically places your QML files in the resource system. To access them, load your main QML file as a resource or as a URL with the `qrc` scheme. The path in the resource system where your QML files are placed can be found by concatenating:

- the `RESOURCE_PREFIX` you have passed to qt_add_qml_module.
- `/qt/qml`, if you have not passed `RESOURCE_PREFIX` to qt_add_qml_module and QTP0001 policy is set to `NEW`.
- `/`, if you have not passed `RESOURCE_PREFIX` to qt_add_qml_module and QTP0001 policy is `not` set to `NEW`.
- If you have not passed `NO_RESOURCE_TARGET_PATH` to qt_add_qml_module: the `URI` you have passed to qt_add_qml_module with dots replaced by slashes.

For example, a module called `My.Own.Module` is placed at:

- `:/qt/qml/My/Own/Module/` if you have specified `/qt/qml` as `RESOURCE_PREFIX`, or you have not passed `RESOURCE_PREFIX` and QTP0001 policy is set to `NEW`.
- `:/My/Own/Module/` if you have specified `/` as `RESOURCE_PREFIX`, or you have not passed `RESOURCE_PREFIX` and QTP0001 policy is not set to `NEW`.
- `:/Some/Prefix/My/Own/Module/` if you have specified `Some/Prefix/` as `RESOURCE_PREFIX`
- `:/` if you have specified `NO_RESOURCE_TARGET_PATH`

Once this is done, all files specified by relative paths in QML are loaded from the resource system. Use of the resource system is completely transparent to the QML layer; this means all QML code should refer to resource files using relative paths and should not use the `qrc` scheme. This scheme should only be used from C++ code to refer to resource files.

Note: When using qmake, you need to manually place your files in the resource system. See the qmake Manual and the general documentation on the resource system for how to do this. It's advisable to still follow the path naming convention outlined above.

## Related Information

- Deploying Qt Applications
- Qt Creator: Run on many platforms
- Exposing Attributes of C++ Types to QML
- The Qt Resource System

QML type compiler ◦ qmllint