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

GridView doesn't re-layout items if an item is removed from outside the visible area

    XMLWordPrintable

Details

    • 1686a82f3859ce2a0f48774ded21bf9817f5abc9

    Description

      With the following example, flick to the bottom of the GridView and press Return to remove the first item. Now scroll to the top and observe there is a hole where the first item should be; the GridView has not updated its layout. This does not happen if the item is removed while it's in view.

      import QtQuick 2.0
      
      Item {
          width: 300; height: 300
      
          GridView {
              id: view2
              width: 240; height: 320
              cellWidth: 80; cellHeight: 60
      
              model: ListModel {
                  id: model2
                  Component.onCompleted: {
                      for (var i=0; i<20; i++)
                          append({'name': 'item ' + i, 'size': 20 })
                  }
              }
              delegate: Rectangle {
                  width: 80; height: 60; border.width: 1
                  Text { text: name }
              }
          }
      
          focus: true
          Keys.onReturnPressed: {
              model2.remove(0)
          }
      
          Rectangle {
              anchors.bottom: parent.bottom
              width: 20; height: 20; color: "blue"
              NumberAnimation on x { loops: Animation.Infinite; from: 0; to: 300; duration: 100000 }
          }
      
      }
      
      

      Attachments

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

        Activity

          People

            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

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes