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

ListView.contentHeight does not include header and footer item heights

    XMLWordPrintable

Details

    Description

      ListView.content height should include header and footer item heights but currently it seems to include only the "main content".

      The following example gives 50 for the contentHeight even though it should give 150.

      import QtQuick 2.0
      
      Item {
          width: 200
          height: 400
          ListView {
              id: list
              anchors.fill: parent
      
              Component.onCompleted: console.log("contentHeight: " + contentHeight)
              onContentHeightChanged: console.log("contentHeight: " + contentHeight)
      
              model: 1
              footer: Rectangle {
                  width: list.width
                  height: 50
                  color: "red"
                  border.width: 1
                  border.color: "black"
              }
              delegate: Rectangle {
                  width: list.width
                  height: 50
                  color: "blue"
                  border.width: 1
                  border.color: "black"
              }
              header: Rectangle {
                  width: list.width
                  height: 50
                  color: "green"
                  border.width: 1
                  border.color: "black"
              }
          }
      }
      

      Attachments

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

        Activity

          People

            martjone Martin Jones (closed Nokia identity) (Inactive)
            skananoj Sami Kananoja
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes