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

ListView with a huge amount of items crashes during a random scrolling

    XMLWordPrintable

Details

    • 52187b084491641ef80536c743c2261af8bfe11c

    Description

      ListView with huge amount of elemens and limited highlightMoveDuration can crash an application if it is scrolled by changing of currentIndex. To reproduce a bug, one can execute a following code in QML application (e.g. generated by qtcreator 2.0). Change an orientation during the random scrolling can "help" to crash the application.

      import QtQuick 1.0
      
      Item {
      //    width: 300
      //    height: 600
          ListModel {
              id: playlist
          }
      
          ListView {
              id: listview
      
              anchors.fill: parent
              model: playlist
              delegate: playlistDelegate
              highlightMoveDuration: 500
      
           }
      
          Rectangle {
              id: button
              width: 100; height: 50
              color: "green"
              anchors.bottom: parent.bottom
              MouseArea {
                  anchors.fill: parent
                  onClicked: listview.currentIndex = Math.random() * (listview.count - 1)
              }
      
              Text {
                  anchors.centerIn: parent
                  text: "Go random"
              }
          }
      
          Component {
              id: playlistDelegate
      
              Item {
                  height: 75
                  width: listview.width
                  Row {
                      Text {
                          text: index + 1 + "."
                          color: "green"
                      }
                      Text {
                          text: "  " + num
                          color: "green"
                      }
                  }
              }
          }
      
          Component.onCompleted: {
              for (var i = 0; i < 50000; i++)
                  playlist.append({"num":  Math.random(), "num1": Math.random(), "num2": Math.random(), "num3": Math.random(), "num4": Math.random(), "num5": Math.random(), "num6": Math.random(), "num7": Math.random()})
          }
      }
      

      Attachments

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

        Activity

          People

            dajansen Damian Jansen (closed Nokia identity) (Inactive)
            andriyas Alexey Andriyashin (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