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

QML list property can't be initialized with a Qt.binding value

    XMLWordPrintable

Details

    Description

      Continuation of https://bugreports.qt.io/browse/QTBUG-116625

      list<> properties can not be initialized with an initialProperties value of a Qt.binding magic object.

      import QtQml
      
      QtObject {
          objectName: "root"
          property Component testComponent: QtObject {
              property list<QtObject> bug
          }
          Component.onCompleted: {
              let obj = testComponent.createObject(this, {
                  bug: Qt.binding(() => []),
              });
              print(obj, obj.bug.length, obj.bug);
              // Prints: QObject_QML_1 1 [null]
      
              obj = testComponent.createObject(this, {
                  bug: Qt.binding(() => this),
              });
              print(obj, obj.bug.length, obj.bug);
              // Prints: QObject_QML_1 1 [null]
          }
      }
      

      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
            ratijas ivan tkachenko
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes