Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.3.1
-
None
Description
We should figure out what's the state of the art regarding default qml import paths for macOS app bundles, what to recommend going forward, and how to adjust our example projects.
Currently we have a few different ways we handle qml import paths for macOS app bundles.
1)
Explicit addImportPath call to a PlugIns subdir plus manual copying around of qmldir and plugins files
https://github.com/qt/qtdeclarative/blob/99f501c2fca1c8cc33b48ff694c9243b92d0742c/examples/qml/tutorials/extending-qml/chapter6-plugins/main.cpp#L13
https://github.com/qt/qtdeclarative/blob/99f501c2fca1c8cc33b48ff694c9243b92d0742c/examples/qml/tutorials/extending-qml/chapter6-plugins/Charts/CMakeLists.txt#L27
2)
Calling addImportPath via DECLARATIVE_EXAMPLE_MAIN pointing to PlugIns subdir + macro to copy around the qmldir
https://github.com/qt/qtdeclarative/blob/99f501c2fca1c8cc33b48ff694c9243b92d0742c/examples/quick/customitems/painteditem/main.cpp#L4
https://github.com/qt/qtdeclarative/blob/99f501c2fca1c8cc33b48ff694c9243b92d0742c/examples/quick/customitems/painteditem/CMakeLists.txt#L46
https://github.com/qt/qtdeclarative/blob/99f501c2fca1c8cc33b48ff694c9243b92d0742c/examples/quick/draganddrop/CMakeLists.txt#L49
https://github.com/qt/qtdeclarative/blob/99f501c2fca1c8cc33b48ff694c9243b92d0742c/examples/quick/shared/CMakeLists.txt#L41
https://github.com/qt/qtdeclarative/blob/99f501c2fca1c8cc33b48ff694c9243b92d0742c/examples/quick/shared/QtBundleQmlModuleForMacOS.cmake
3)
Using new Resources/qml import path introduced with https://codereview.qt-project.org/c/qt/qtdeclarative/+/384645
to be used with the Qt 6.3+ deployment API, an no manual addImportPath call
This manually calls addImportPath to Resources/qml, before the change above landed, but after deployment API was mostly done.
https://git.qt.io/crscott/qml_example/-/blob/new-install-support/main.cpp#L13
One concern was that we can't use the new API to place stuff correct in the bundle of our examples yet, because it's still in Technical Preview.
But the default import path is not in TP, so in principle manual addImportPath calls in our examples could be removed if we also adjust the location of qmldirs and plugins.
4)
Recently a new default import path for user projects was introduced via
https://codereview.qt-project.org/c/qt/qtdeclarative/+/413575
which is qrc:/qt/qml
Need to consider if that changes anything.
We also had some previous discussion at https://codereview.qt-project.org/c/qt/qtdeclarative/+/366961/comments/96650614_1b7b2adf
and
https://bugreports.qt.io/browse/QTBUG-98545?focusedCommentId=600495&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-600495
Attachments
Issue Links
- relates to
-
QTBUG-101338 Investigate removing usage of symlinks for QML modules in macOS app bundles
- Reported
-
QTBUG-103452 Establish sane resource prefix for QML modules
- Closed
-
QTBUG-95145 Facilitate automatic addition of a project specific qml import path to the qml engine using CMake
- Closed
-
QTBUG-98545 Provide CMake API for deployment support
- Closed