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

QML module created with the new QML CMake API does not get automatically loaded on Windows when main.qml locates in the created module

    XMLWordPrintable

Details

    • Windows

    Description

      QML module containing the main.qml is not loaded automatically when QML module is created using the new QML CMake API in a subdirectory using: add_subdirectory() and the created module (mainQml in the example) is linked with the app by using:

      target_link_libraries(appCmakeTest
      PRIVATE Qt6::Quick
      mainQml
      )
      According to build logs necessary files are passed to linker but this linking seems to be optimized away on Windows (but not on other systems).

      Way to reproduce:

      On Windows, build and run the attached example project with Qt 6.2.3.

      Application crashes and in application output it says:
      "QQmlApplicationEngine failed to load component
      qrc:/mainQml/main.qml: No such file or directory"

      Expected behavior would be that module is loaded automatically and in the application "Works Ok" text is visible.

      Linker can be "fooled" by adding some symbol from the mainQml which results the plugin to be loaded on startup like intended.

      Manually loading the plugin can be used as a workaround on Windows with such approach.

      Attachments

        Issue Links

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

          Activity

            People

              alexandru.croitor Alexandru Croitor
              foxxx Tuukka Kettunen
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes