Uploaded image for project: 'Qt Creator'
  1. Qt Creator
  2. QTCREATORBUG-29864

Qt Creator adds other projects' QML import paths to the current project

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P2: Important P2: Important
    • None
    • Qt Creator 11.0.3, Qt Creator 12.0.0-beta2
    • Quick / QML Support
    • Windows 10 22H2

      Steps to reproduce

      1. Download the attached archive
      2. Load ProjectA first
      3. Load ProjectB second
      4. Open ProjectA/main.qml
      5. In the code editor, hover your mouse cursor over the import statement, "import content" to reveal the full path to the imported module
      6. In the code editor, inspect the property of the App object
      7. Repeat Steps #4 - #6 with ProjectB/main.qml

       

      Expected outcomes

      • Step #5: The path should correspond to the current project's build folder.
      • Step #6: There should be no errors/warnings on the property. Hovering your mouse cursor over the property should reveal its correct datatype.

       

      Actual outcomes
      (For one of the projects, probably ProjectB):

      • Step #5: The path corresponds to the other project's build folder.
      • Step #6: We see the error, "Invalid property name" (M16)

       

      Cause
      QML_IMPORT_PATH seems to be a global setting, rather than a per-project setting. You can verify this by adding an invalid import statement: The tooltip will show that both projects are in the import path.

       

      Notes
      These projects are near-vanilla copies of the Qt Design Studio CMake template. The only changes are:

      • A single property alias is added to each project's App type and accessed in the corresponding main.qml (a different property for each project)
      • QT_QML_OUTPUT_DIRECTORY and QML_IMPORT_PATH are set to work around QDS-11149

        1. qtc-multiple-import-paths.png
          103 kB
          Sze Howe Koh
        2. qtc-wrong-project-import-1.png
          93 kB
          Sze Howe Koh
        3. TwoProjects.zip
          25 kB
          Sze Howe Koh
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qtqmlteam Qt Qml Team User
            skoh-qt Sze Howe Koh
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes