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

QML Repeater should allow creation of objects

XMLWordPrintable

    • All

      Today, Repeater can create QQuickItems only. It would be very useful if it could also create Objects (i.e., QtObjects). The reason is that will allow C+-defined models to be passed to C+ from QML.

      The BirthdayParty example included in Qt, which demonstrates attached properties, uses default properties for Person declarations. It inlines three "Person"s line this:

       

      BirthdayParty {
          Person { }
          Person { }
          Person { }
      }

       

      But given that you have a data source for each person, it's cleaner to define this dynamically using a Repeater, as in the below example:

       

      BirthdayParty {
          Repeater {
              model: 3
              Person {
              }
          }
      }

      Unfortunately, Person is an QObject, so this does not compile/work.

       

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

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            andrhans Andreas Aardal Hanssen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes