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

[Reg 6.2->6.3] Component.createObject() no longer copies QQmlListProperty values correctly

    XMLWordPrintable

Details

    • 0c50edd6f (dev), d9bfd8d5c (6.5), 60915b00b (6.6)

    Description

      This issue also affects TestCase.createTemporaryObject()

       

      Code
      (attached, adapted from https://github.com/qt/qtdeclarative/tree/v6.4.3/examples/qml/referenceexamples/default )

      import QtQuick
      import People
      
      Window {
          id: root
          width: 640
          height: 480
          visible: true
      
          Person { id: h0; name: "Bob Jones" }
          Person { id: g1; name: "Leo Hodges" }
          Person { id: g2; name: "Jack Smith" }
          Person { id: g3; name: "Anne Brown" }
      
          BirthdayParty {
              id: party1
              host: h0
              guests: [g1, g2, g3]
          }
          Component {
              id: partyComp
              BirthdayParty {}
          }
      
          function announceParty(party: BirthdayParty) {
              console.log(`${party.host.name} is having ${party.guests.length} guests. They are:`)
              for (let i = 0; i < party.guests.length; ++i)
                  console.log('\t', party.guests[i].name)
          }
      
          Component.onCompleted: {
              let party2 = partyComp.createObject(root, { host: h0, guests: [g1, g2, g3] });
      
              announceParty(party1)
              announceParty(party2)
          }
      }
      
      

       

      Expected output (Qt 6.2.8)

      qml: Bob Jones is having 3 guests. They are:
      qml:      Leo Hodges
      qml:      Jack Smith
      qml:      Anne Brown
      qml: Bob Jones is having 3 guests. They are:
      qml:      Leo Hodges
      qml:      Jack Smith
      qml:      Anne Brown
      

       

      Actual output (Qt 6.3.2 and newer)

      qml: Bob Jones is having 3 guests. They are:
      qml:      Leo Hodges
      qml:      Jack Smith
      qml:      Anne Brown
      qml: Bob Jones is having 1 guests. They are:
      qrc:example.qml:28: TypeError: Cannot read property 'name' of null
      

      Attachments

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

        Activity

          People

            ulherman Ulf Hermann
            skoh-qt Sze Howe Koh
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes