Qt 是否可以在qml中对项目进行循环刷卡?

Qt 是否可以在qml中对项目进行循环刷卡?,qt,qml,Qt,Qml,我在qml中使用swipeview。我可以从第一个到最后一个来回滑动项目。是否可以立即从决赛刷到第一名?我在文档中没有找到任何信息 你可以用它来做。Qt Quick Controls 2也可以设置为,因为它在内部使用了PathView。您可以使用PathView。有些代码如下: import QtQuick 2.0 Rectangle { width: 200 height: 200 ListModel { id: model List

我在qml中使用swipeview。我可以从第一个到最后一个来回滑动项目。是否可以立即从决赛刷到第一名?我在文档中没有找到任何信息

你可以用它来做。Qt Quick Controls 2也可以设置为,因为它在内部使用了
PathView

您可以使用PathView。有些代码如下:

import QtQuick 2.0

Rectangle {
    width: 200
    height: 200

    ListModel {
        id: model
        ListElement {
            color: "red"
        }
        ListElement {
            color: "green"
        }
        ListElement {
            color: "blue"
        }
    }

    Component {
        id: delegate
        Rectangle {
            id: wrapper
            width: view.width
            height: view.height
            color: model.color

            Text {
                anchors.centerIn: parent
                font.pointSize: 26
                font.bold: true
                color: "white"
                text: index
            }
        }
    }

    PathView {
        id: view
        anchors.fill: parent
        snapMode: PathView.SnapOneItem
        highlightRangeMode: PathView.StrictlyEnforceRange
        currentIndex: -1
        model: model
        delegate: delegate
        path: Path {
            startX: -view.width / 2  // let the first item in left
            startY: view.height / 2  // item's vertical center is the same as line's

            PathLine {
                relativeX: view.width * view.model.count  // all items in lines
                relativeY: 0
            }
        }
    }
}