title: Qt QML ListView visible
body: <p>I've found the following code in a QML example. I have a question about sections: is there a way to hide all the elements belonging to a section when the user clicks on the section header? For example, is it possible to hide "Ant" and "Flea" when the user clicks the "Tiny" header?</p>
  
  <p>Here is the code:</p>
  
  <pre><code>Rectangle {
      id: container
      width: 300
      height: 360
  
      ListModel {
          id: animalsModel
          ListElement { name: "Ant"; size: "Tiny" }
          ListElement { name: "Flea"; size: "Tiny" }
          ListElement { name: "Parrot"; size: "Small" }
          ListElement { name: "Guinea pig"; size: "Small" }
          ListElement { name: "Rat"; size: "Small" }
          ListElement { name: "Butterfly"; size: "Small" }
          ListElement { name: "Dog"; size: "Medium" }
          ListElement { name: "Cat"; size: "Medium" }
          ListElement { name: "Pony"; size: "Medium" }
          ListElement { name: "Koala"; size: "Medium" }
          ListElement { name: "Horse"; size: "Large" }
          ListElement { name: "Tiger"; size: "Large" }
          ListElement { name: "Giraffe"; size: "Large" }
          ListElement { name: "Elephant"; size: "Huge" }
          ListElement { name: "Whale"; size: "Huge" }
      }
  
      // The delegate for each section header
      Component {
          id: sectionHeading
          Rectangle {
              id: sectionHeadingRectangle
              width: container.width
              height: childrenRect.height
              color: "lightsteelblue"
  
              Text {
                  text: section
                  font.bold: true
                  font.pixelSize: 20;
              }
          }
      }
  
      Component {
          id: section
          Rectangle {
              width: container.width
              height: mainText.height
  
              Text { id: mainText; text: name; font.pixelSize: 18 }
          }
      }
  
      ListView {
          id: view
          anchors.fill: parent
          // width: parent.width
          model: animalsModel
          delegate: section
  
          section.property: "size"
          section.criteria: ViewSection.FullString
          section.delegate: sectionHeading
      }
  }
  </code></pre>