Details
-
Bug
-
Resolution: Fixed
-
P2: Important
-
QDS 3.1
Description
Problem
After following the instructions at https://doc.qt.io/qtdesignstudio/quick-converting-ui-projects.html#adding-qt-quick-designer-components-to-qt-installations, the QML module gets installed correctly to <QT>/6.2.3/iOS/qml/QtQuick/Studio/Components/
However, if we use the module in our project and run the project from Qt Creator, we get the error, `module "QtQuick.Studio.Components" is not installed.`
This does not occur for Android or Windows.
Investigations
I built and ran the attached project from Qt Creator for a few other platforms, setting QML_IMPORT_TRACE=1. Some notable lines appear:
Android (Qt 5.15.2):
D libArcItemTest_x86.so: QQmlImports(qrc:/main.qml)::resolveType: "Button" => "" QUrl("qrc:/android_rcc_bundle/qml/QtQuick/Controls.2/Button.qml") TYPE/URL D libArcItemTest_x86.so: QQmlImports(qrc:/main.qml)::resolveType: "ArcItem" => "" QUrl("qrc:/android_rcc_bundle/qml/QtQuick/Studio/Components/ArcItem.qml") TYPE/URL
Windows (Qt 6.2.3):
qt.qml.import: resolveType: qrc:/main.qml "Button" => "" QUrl("qrc:/qt-project.org/imports/QtQuick/Controls/Windows/Button.qml") TYPE/URL qt.qml.import: resolveType: qrc:/main.qml "ArcItem" => "" QUrl("file:///C:/Qt/6.2.3/msvc2019_64/qml/QtQuick/Studio/Components/ArcItem.qml") TYPE/URL
Summary
- For Android, all QML modules get embedded in a QRC, so the app runs fine.
- For Windows, QtQuick.Controls 2 gets embedded in a QRC but QtQuick.Studio.Components doesn't. Nonetheless, the standalone *.qml files can be loaded from the dev folder so the app runs fine.
I'm guessing that for iOS, the *.qml files of QtQuick.Studio.Components don't get embedded in a QRC but they don't get copied onto the target either, so the app can't run.
Workaround 1
Copy the contents of <QT>/6.2.3/iOS/qml/QtQuick/Studio/Components/ directly into the project and add the files to the project's QRC. This way, the *.qml files get embedded into the final executable.
Workaround 2 (identified by max.goldstein below)
Modify <QT>/6.2.3/iOS/qml/QtQuick/Studio/Components/qmldir and add these lines to the top:
module QtQuick.Studio.Components typeinfo plugins.qmldir classname QtStudioComponentsPlugin plugin studiocomponentsplugin