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

Putting *.js file under QML_FILES and applying QTP0004 can break QML engine's ability to import module

    XMLWordPrintable

Details

    • f7e29f7d2 (dev), a315e8caa (6.9), f1351ad76 (6.8)

    Description

      The attached project has this structure:

      ./
      ├── CMakeLists.txt
      ├── Main.qml
      ├── main.cpp
      └── MyLib/
          └── CMakeLists.txt
              qml/
              ├── GreenRect.qml
              └── MyScript.js
      

       

      It builds fine but fails to run with a weird error message:

      QQmlApplicationEngine failed to load component
      qrc:/qt/qml/MyApp/Main.qml:9:2: Type GreenRect unavailable
      qrc:/qt/qml/MyLib/qml/GreenRect.qml: "MyLib" is ambiguous. Found in qrc:/qt/qml/MyLib/ and in qrc:/qt/qml/MyLib/
      

       

      Workarounds
      The error disappears if any of the following actions are taken:

      • Disable QTP0004
      • Move the GreenRect.qml and MyScript.js out of the "qml" subfolder
      • Remove MyScript.js from the module
      • Don't let GreenRect.qml do "import MyLib"

      Attachments

        For Gerrit Dashboard: QTBUG-133587
        # Subject Branch Project Status CR V

        Activity

          People

            ulherman Ulf Hermann
            skoh-qt Sze Howe Koh
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes