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

Required properties in inner elements of delegates cause views to omit model data from context

    XMLWordPrintable

Details

    • 04f9219a38 (qt/qtdeclarative/dev) 04f9219a38 (qt/tqtc-qtdeclarative/dev)

    Description

      Example:

      Item {
          ListModel {
              id: myModel
              ListElement { type: "Dog"; age: 8; noise: "meow" }
              ListElement { type: "Cat"; age: 5; noise: "woof" }
          }
          
          component SomeDelegate: Item {
              required property int age
              property string text
          }
          
          component AnotherDelegate: Item {
              property int _age
              property string _text
              
              SomeDelegate {
                  age: 0
                  text: ""
              }
          }
      
          Repeater {
              model: myModel
              delegate: AnotherDelegate {
                  _age: model.age
                  _text: model.noise
              }
          }
      }
      

      AnotherDelegate itself has no required properties and therefore should receive "model" as context property. The required property on SomeDelegate prevents this. It shouldn't.

      Attachments

        Issue Links

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

          Activity

            People

              ulherman Ulf Hermann
              ulherman Ulf Hermann
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes