是否可以将QML中的Pathview元素设置为在到达模型中的最后一个元素时停止?

时间:2011-08-08 05:41:08

标签: qml

Pathview在到达结束时旋转到第一个元素,到达结尾时如何停止? 感谢

1 个答案:

答案 0 :(得分:0)

import QtQuick 1.0

Rectangle {
    id: rectangle1
    width: 360
    height: 360
    color: "grey"
    opacity: 1
    ListModel {
        id: listModel
        ListElement {
            name: "Bill Smith"
            number: "555 3264"
        }
        ListElement {
            name: "John Brown"
            number: "555 8426"
        }
        ListElement {
            name: "Sam Wise"
            number: "555 0473"
        }
    }
    Component {
        id: delegate
            Text {
                id: nameText
                width: 64; height: 20
                wrapMode: Text.Wrap
                text: name
            }

    }
    Rectangle {
        y:parent.height/2
        width: parent.width
        height: parent.height/2
        ListView {
            width: parent.width
            height: parent.height
            model:  listModel

            focus: true
            delegate: Text {
                      id: item
                      text: name + ": " + number
                  }
            preferredHighlightBegin: 20
            preferredHighlightEnd: 40
            highlightRangeMode: ListView.StrictlyEnforceRange
            highlight: Rectangle { color: "lightblue"; radius:  5 }
        }
    }
}

这种效果可以通过ListView实现,具有属性设置。