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

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

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes