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

Improve workflow for updating QML code model

    XMLWordPrintable

Details

    Description

      Case study

      Project contents

      <ROOT>/CMakeLists.txt
      <ROOT>/main.h
      <ROOT>/main.cpp
      <ROOT>/main.qml
      <ROOT>/MyLib/CMakeLists.txt
      <ROOT>/MyLib/GreenRect.qml
      <ROOT>/MyLib/RedRect.qml
      
      1. Build and run the attached project. It currently doesn't run correctly because we forgot to add "RedRect.qml" to the project.
      2. Open main.qml. Notice the "Unknown component" error, as expected.
      3. Fix "MyLib/CMakeLists.txt" by adding "RedRect.qml" to "QML_FILES".
      4. Build and run the project again. Notice that CMake has re-run, RedRect.qml is now in the project tree, and the application now runs correctly.

      However, the "Unknown component" error remains. We need to manually click "Tools" > "QML/JS" > "Reset Code Model" to make the error go away.

       

      Suggestions

      • Add a default keyboard shortcut for "Reset Code Model", so that users don't need to make a custom one in order to avoid clicking 3 levels of menus.
      • Add an option to automatically reset the code model whenever CMake re-runs

      Attachments

        1. unknown-component.png
          unknown-component.png
          15 kB
        2. MyApp.zip
          2 kB

        Activity

          People

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

            Dates

              Created:
              Updated: