Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-104554

Revisit our story about the default qml import path for macOS app bundles

    XMLWordPrintable

Details

    • macOS

    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

      https://github.com/qt/qtdeclarative/blob/99f501c2fca1c8cc33b48ff694c9243b92d0742c/tests/auto/cmake/test_qml_app_deployment/CMakeLists.txt#L54

      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

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtbuildsystem Qt Build System Team
              alexandru.croitor Alexandru Croitor
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes