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

Scrolling on ScrollView with ListView is incorrect after "move" in model

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Not Evaluated
    • 5.5.0
    • 5.4.2
    • Quick: Controls 1
    • None
    • Windows 8.1 Pro (mingw492_32)

    Description

      Steps to occur problem in the example appplication:
      1. Scroll down.
      2. Click on one of the buttons
      3. Scrolling is no more correct

      import QtQuick 2.4
      import QtQuick.Controls 1.3
      import QtQuick.Window 2.2
      
      ApplicationWindow {
          title: qsTr("Example 3")
          width: 640
          height: 480
          visible: true
          toolBar: Column {
              width: parent.width
      
              Text {
                  width: toolBar.width
                  wrapMode: Text.WordWrap
                  text: "Description: Scroll down. Click one of the buttons below. Scrollbar and layouting is broken. (Correctly only if scrollbar position on beginning while click)"
              }
              Button {
                  text: "add to begin and remove from end"
      
                  onClicked: {
                      testModel.insert(0, {"test": 999})
                      testModel.remove(testModel.count - 1)
                  }
              }
              Button {
                  text: "move from end to begin"
      
                  onClicked: {
                      testModel.move(testModel.count - 1, 0, 1)
                  }
              }
          }
          Component.onCompleted: {
              for(var i = 0; i < 20; i++) {
                  testModel.append({"test": i})
              }
          }
      
          ListModel {
              id: testModel
          }
          ScrollView {
              anchors { fill: parent }
              flickableItem.interactive: true
      
              ListView {
                  id: listView
      
                  anchors { fill: parent }
      
                  spacing: 5
      
                  model: testModel
                  delegate: Rectangle {
                      width: listView.width
                      height: 90
                      border.color: "black"
                      color: "gray"
      
                      Text {
                          anchors.centerIn: parent
                          color: "black"
                          text: test
                      }
                  }
              }
          }
      }
      

      Attachments

        1. example3.png
          example3.png
          18 kB
        2. example3.zip
          2 kB

        Activity

          People

            Unassigned Unassigned
            permotion88 Karol Polak
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: