Deploying Qt Quick Controls Applications
Deployment of Qt Quick Controls applications is very similar to deployment of other types of Qt applications. However, there are a few factors to consider.
Suppose you have an application that will be deployed to both Android and Windows devices. To ensure that only the minimum set of files that are necessary for the application to run are deployed to each device, you can use file selectors. For example, your directory structure could look like this:
resources.qrc main.qml +windows/MyPage.qml +windows/qtquickcontrols2.conf +android/MyPage.qml +android/qtquickcontrols2.conf
In the project above,
main.qml would import
QtQuick.Controls, for example, but shouldn't import, say,
QtQuick.Controls.Material. Any code that is style-specific is moved out into separate files; just as we've done for
+windows/qtquickcontrols2.conf file would contain configuration options specific to the Universal style:
[Controls] Style=Universal [Universal] Theme=Dark Accent=Red
+android/qtquickcontrols2.conf file would contain configuration options specific to the Material style:
[Controls] Style=Material [Material] Theme=Light Accent=Brown
For dynamically built applications, it is not necessary to import a specific style that should be usable by that application. For statically built applications, Qt's build system must be involved to ensure that QML plugins function as expected. Specifically,
qmlimportscanner to scan the QML files in your application for import statements. For this reason, any styles that should be usable by a statically built application must explicitly import that style. Where the import occurs is up to the developer, but it is recommended to follow the approach mentioned in the Deploying an Application with Several Styles section, so that only the minimum set of files that are necessary for a particular device are deployed.
© 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.