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

CMake/qml applications cannot be set up to load qml sources at runtime

    XMLWordPrintable

Details

    • All

    Description

      I have a cmake / qml application running on an embedded target. If I want to make a minor change to a qml file, I need to rebuild, deploy and restart the app. I should be able to edit qml sources on the target and restart the app to see my changes.

      In qt5 / qmake projects, we could load qml sources at runtime. I think this ability has been lost in qt6.

      I can get a Loader to load qml at runtime. However, for my use case, I need all of my qml types to load at runtime without using a Loader.

      eg. in the following code, I need 'first' to be loaded at runtime.

       

      MyRectangle { id: first } // this is defined at compile time
      Loader {
          source: "file:///path/to/MyRectangle.qml" // this is defined at run time
      }
      

      This is an issue for the users of the project that don't want to download source code and a toolchain, install qt, and rebuild the app. They just want to edit on the device.

      I am currently adding qml sources via 'qt_add_qml_module', however I will use a different approach if it gives me what I want.

      I have example code here: https://github.com/DanielMcInnes/helloQmlTc branch: 'load-qml-at-runtime')

      It is not clear from the documentation if what I want is possible. Apologies in advance if I have missed something.

      Attachments

        Issue Links

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

          Activity

            People

              qtbuildsystem Qt Build System Team
              daniel_mcinnes Daniel McInnes
              Votes:
              3 Vote for this issue
              Watchers:
              9 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes