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

Changing highlightRangeMode causes PathView crash

    XMLWordPrintable

Details

    Description

      Run the following code, enter return 5 times, the qmlscene will crash with:

      VisualDataModel::item: index out range -1 4

      import QtQuick 2.0
      
      Rectangle {
          width: 400; height: 240
          color: "white"
      
          ListModel {
              id: appModel
              ListElement { name: "Music"}
              ListElement { name: "Movies"}
              ListElement { name: "Camera"}
              ListElement { name: "Calendar"}
              function shuffle() {
                 appModel.move(0, 3, 1);
              }
          }
      
          Component {
              id: appDelegate
              Item {
                  width: 100; height: 100
                  scale: PathView.iconScale
      
                  Text {
                      anchors { horizontalCenter: parent.horizontalCenter }
                      text: name
                      smooth: true
                  }
      
                  MouseArea {
                      anchors.fill: parent
                      onClicked: view.currentIndex = index
                  }
              }
          }
      
          Component {
              id: appHighlight
              Rectangle { width: 80; height: 80; color: "lightsteelblue" }
          }
      
          PathView {
              id: view
              anchors.fill: parent
              highlight: appHighlight
              preferredHighlightBegin: 0.5
              preferredHighlightEnd: 0.5
              focus: true
              model: appModel
              delegate: appDelegate
              path: Path {
                  startX: 10
                  startY: 50
                  PathAttribute { name: "iconScale"; value: 0.5 }
                  PathQuad { x: 200; y: 150; controlX: 50; controlY: 200 }
                  PathAttribute { name: "iconScale"; value: 1.0 }
                  PathQuad { x: 390; y: 50; controlX: 350; controlY: 200 }
                  PathAttribute { name: "iconScale"; value: 0.5 }
              }
              Keys.onReturnPressed: {
                highlightRangeMode = PathView.NoHighlightRange
                appModel.shuffle();
                currentIndex =  3;
                highlightRangeMode = PathView.StrictlyEnforceRange
              }
          }
      }
      

      Attachments

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

        Activity

          People

            martjone Martin Jones (closed Nokia identity) (Inactive)
            charles Charles Yin (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