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

ListView attached properties for sections do not work at all

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P1: Critical P1: Critical
    • None
    • 5.4.1
    • None
    • Any

      The following code:

      ApplicationWindow {
          visible: true
      
          ListView {
              anchors.fill: parent
      
              model: ListModel {
                  ListElement { name: "A"}
                  ListElement { name: "B"}
                  ListElement { name: "C"}
                  ListElement { name: "D"}
                  ListElement { name: "E"}
              }
      
              delegate: Text {
                  text: model.name
              }
      
              section.property: "name"
              section.delegate: Text {
                  text: section
                  Component.onCompleted: {
                      console.log("section (attached):", ListView.section)
                      console.log("previous section (attached):", ListView.previousSection)
                      console.log("next section (attached):", ListView.nextSection)
                      console.log("section:", section) // the only valid line
                      console.log("previous section:", previousSection)
                      console.log("next section:", nextSection)
                  }
              }
          }
      }
      
      

      only displays valid console output for:
      console.log("section:", section)

      The attached project contains a version which uses a TableView instead - that doesn't work either.
      Checked for dekstop (Windows) and mobile (Android).

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

            srutledg Shawn Rutledge
            ddobrev Dimitar Dobrev
            Votes:
            8 Vote for this issue
            Watchers:
            12 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes