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

PathView does not move to the right item when set highlightMoveDuration to 0

    XMLWordPrintable

Details

    Description

      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: {
                appModel.shuffle();
                highlightMoveDuration = 0  //comment this line, the current item will be "Music", with this line the current item changes to "Movie"
                currentIndex =  3;
                highlightMoveDuration = 200
              }
          }
      }
      
      

      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