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

Moving from before the first visible item in ListView doesn't work correctly

    XMLWordPrintable

Details

    Description

      With the following code, press enter to change the content y to 80, then space to do a move(1, 18, 1).

      Then, flick downwards. Observe the items are ordered incorrectly: the top item is Item 19 and the bottom item in the view is Item 16. The item ordering range is 19-29 followed by 12-16. This is fixed eventually if you flick up and down a bit to refill but then the first item (Item 0) ends up at -360.

      Additionally, Item 1 is now just above the visible area and it will stay outside of the visible area even if you try to flick up to it.

      import QtQuick 2.0
      
      Item {
          width: 600; height: 600
      
          ListView {
      
              id: view2
              width: 240; height: 320
              x: 100
              y: 100
      
              model: ListModel {
                  id: model2
                  Component.onCompleted: {
                      for (var i=0; i<30; i++) {
                          append({'name': 'item ' + i})
                      }
                  }
              }
              delegate: Rectangle {
                  border.width: 1
      
                  width: 200; height: 20;
                  Row {
                      Text { text: name + " : " + index + " : " }
                      Text { text: " " + parent.parent.x + ", " + parent.parent.y }
                  }
                  objectName: name
              }
      
              focus: true
              Keys.onSpacePressed: {
                  model.move(1, 18, 1)
              }
      
              Keys.onEnterPressed: {
                  contentY = 80
              }
      
          }
      
      
      
          Rectangle {
              anchors.fill: view2
              color: "lightsteelblue"
              opacity: 0.3
      
          }
          Text { anchors.right: parent.right; text: "content y:" + view2.contentY + ", count: " + model2.count }// + " " + view2.count }
      
      }
      

      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:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes