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

ListView refill not working correctly if any delegate height is 0

XMLWordPrintable

    • 80615c3036e689061588a144339125b7fb8e66e5

      Scroll the view downwards and observe that the delegates are not deleted as they move past the top of the view. This issue does not occur if the first item's height is > 0.

      (Note, however, if the view is scrolled upwards, items that scroll past the bottom of the view are indeed deleted. The issue only occurs for items moving up past the top of the view.)

      import QtQuick 2.0
      
      Item {
          width: 500; height: 500
      
          ListView {
      
              id: view2
              width: 240; height: 320
              x: 100
              y: 100
      
      
              model: ListModel {
                  id: model2
                  Component.onCompleted: {
                      for (var i=0; i<40; i++) {
                          append({'name': 'item ' + i})
                      }
                  }
              }
              delegate: Rectangle {
                  width: 200; height: index == 0 ? 0 : 20; border.width: 1
                  Row {
                      Text { text: name + " : " + index + " : " }
                      Text { text: " " + parent.parent.x + ", " + parent.parent.y }
                  }
                  objectName: name
              }
      
          }
      
          Rectangle {
              anchors.fill: view2
              color: "lightsteelblue"
              opacity: 0.7
      
          }
          Text { anchors.right: parent.right; text: "content y:" + view2.contentY + ", count: " + model2.count }
      
      }
      

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

            bealam Bea Lam (closed Nokia identity) (Inactive)
            bealam Bea Lam (closed Nokia identity) (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes