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

Type compiler unable to use components from imported modules

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • Some future release
    • 6.5.8, 6.6.3
    • QML: Compiler
    • None
    • All

    Description

      The QML Type Compiler indicates "Warnings occurred while importing module" and the when using the QML Component in question, it appears to not be found.

      To replicate the issue:

      1. Create 2 or more QML modules with qt_add_qml_module. Each module must have a QML file
      2. Import one module, let's call it second module, into the other module, let's call it main module
      3. Import and instantiate a QML component of the second module from the main module.
      4. ENABLE_TYPE_COMPILER on both modules

      Example code is attached. Important excerpts here:

      // Second module's CMakeLists.txt

      qt_add_qml_module(${PROJECT_NAME}
          URI SharedModule
          VERSION 1.0
          RESOURCE_PREFIX /qt/qml/
          QML_FILES
          "SharedModule.qml"
          ENABLE_TYPE_COMPILER
      )

      // Second module's .qml file

      Rectangle {
          color: "#234567"
      }

      // First module's CMakeLists.txt

      qt_add_qml_module(${PROJECT_NAME}
          URI Experiments
          VERSION 1.0
          RESOURCE_PREFIX /qt/qml/
          IMPORTS
          SharedModule
          QML_FILES
          "main.qml"
          ENABLE_TYPE_COMPILER
      )

      // First module's .qml file

      import SharedModule

      SharedModule {
          width: 400
          height: 200
      }

      Note:
      This fails in the same way regardless of whether the modules are imported Dynamically or Statically.

      Attachments

        Issue Links

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

          Activity

            People

              qtqmlteam Qt Qml Team User
              javier.cordero Javier Cordero
              Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes