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

    • Platform/s:
      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:

      ```
      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

            Assignee:
            qt.team.quick.subscriptions Qt Quick and Widgets Team
            Reporter:
            febbe Fabian Ke├čler
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:

                Gerrit Reviews

                There are no open Gerrit changes