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

First construct QML Objects and then add them to QQmlListProperty / Construct QML Objects from the leafs to the root

    XMLWordPrintable

Details

    • All

    Description

      Not sure if this happened in version < Qt6.0.0, but this would be out of scope for those versions (IMAO).

      I found out, that QML Objects are added first to the QQmlListProperty, and then they are initialized with the property bindings.
      This should be the other way around.
      QML Objects should be created from the leaves to the root.

      The code below will first call the QQmlListProperty's append handler, and then the setter for the dataADep and dataBDep properties.

      I would expect an item to be inserted after construction in qml. This is the only efficient way to do some magic under the hood for own QMLTypes. It is also a wrong behaviour of a declarative scripting language.

      Example:

      Unable to find source-code formatter for language: qml. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      MyItem{//...
          data1s: [
              Data1{
                  id: data11//...
              },
              Data1{
                  id: data12//...
              },
              Data1{
                  id: data13//...
              },//...
          ]
          data2s: [
              Data2{
                  dataADep: data11//...
                  dataBDep: data12//...
              },
              Data2{
                  dataADep: data11//...
                  dataBDep: data13//...
              },//...
          ]
          //...
      }
      

      Attachments

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

        Activity

          People

            qtqmlteam Qt Qml Team User
            febbe Fabian Keßler
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes