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

Qml ListView increases contentY when moving a model item to index 0 (with testcase)

XMLWordPrintable

      Please run this testcase:

      import QtQuick 1.1
      
      Rectangle {
        width: 360
        height: 360
      
        ListView {
          id: lv
          anchors.fill: parent
          anchors.bottomMargin: 50
          spacing: 2
          model: ListModel {
            ListElement { text: "A" }
            ListElement { text: "B" }
            ListElement { text: "C" }
            ListElement { text: "D" }
          }
          delegate: Text {
            text: " contentY: " + lv.contentY + " y: " + y + " " + model.text
          }
        }
      
        Text {
          text: "Click to move item at index 1 to index 0"
          anchors.bottom: parent.bottom
          MouseArea {
            anchors.fill: parent
            onClicked: lv.model.move(1, 0, 1 /* n */)
          }
        }
      }
      

      Note that contentY will be increased by the spacing value every time an item is moved to index 0.

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

            martjone Martin Jones (closed Nokia identity) (Inactive)
            njeisecke Nils Jeisecke
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes