[Interest] PathView item missing when preferredHighlightBegin and preferredHighlightEnd are set without setting highlight

Mitch Curtis mitch.curtis at digia.com
Thu Jul 3 16:00:10 CEST 2014


As the title says, the code below results in a missing item (it will 
"disappear" after the view is dragged):

import QtQuick 2.2

Rectangle {
     width: 220
     height: 220
     color: "#494d53"

     PathView {
         id: view
         width: 100
         height: delegateHeight * pathItemCount
         model: ["A", "B", "C"]
         pathItemCount: 3
         anchors.centerIn: parent

         Rectangle {
             anchors.fill: parent
             color: "transparent"
             border.color: "darkorange"
         }

         property int delegateHeight: 0

         activeFocusOnTab: true
         Keys.onDownPressed: view.incrementCurrentIndex()
         Keys.onUpPressed: view.decrementCurrentIndex()
         preferredHighlightBegin: 0.5
         preferredHighlightEnd: 0.5

         delegate: Rectangle {
             width: view.width
             height: textItem.height
             border.color: "red"

             onHeightChanged: if (index == 0) view.delegateHeight = 
textItem.height

             Text {
                 id: textItem
                 text: modelData
             }
         }

         path: Path {
             startX: view.width / 2
             startY: 0
             PathLine {
                 x: view.width / 2
                 y: view.pathItemCount * view.delegateHeight
             }
         }
     }
}

Is this a misuse of PathView, or is it a bug?

Cheers.



More information about the Interest mailing list