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

Cannot make a list the default property

    XMLWordPrintable

Details

    Description

      This code works:

      import QtQuick 1.0
      Rectangle {
          width: 100; height: 100
          Foo {
              bar: [
                  Item { objectName: "Item A" },
                  Item { objectName: "Item B" }
              ]
          }
      }
      

      Foo.qml

      import QtQuick 1.0
      
      QtObject {
          property list<Item> bar: [
              Item { objectName: "Item 1" },
              Item { objectName: "Item 2" },
              Item { objectName: "Item 3" }
          ]
      
          Component.onCompleted: {
              for(var i = 0; i < bar.length; i++) {
                  print("bar: " + bar[i].objectName);
              }
          }
      }
      

      But this does not:

      import QtQuick 1.0
      Rectangle {
          width: 100; height: 100
          Foo {
              Item { objectName: "Item A" }
              Item { objectName: "Item B" }
          }
      }
      

      Foo.qml

      import QtQuick 1.0
      
      QtObject {
          default property list<Item> bar: [
              Item { objectName: "Item 1" },
              Item { objectName: "Item 2" },
              Item { objectName: "Item 3" }
          ]
      
          Component.onCompleted: {
              for(var i = 0; i < bar.length; i++) {
                  print("bar: " + bar[i].objectName);
              }
          }
      }
      

      Attachments

        Issue Links

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

          Activity

            People

              martinj Martin Jones
              mathiasm Mathias Malmqvist
              Votes:
              9 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes