Qt qml ListView制作单页翻页
ListView{
anchors.fill: parent
snapMode: ListView.SnapOneItem
orientation: ListView.Horizontal
model: ListModel{
ListElement{ name: "One"; color: "red" }
ListElement{ name: "Two"; color: "green" }
ListElement{ name: "Three"; color: "blue" }
}
delegate: Rectangle{
color: model.color
width: ListView.view.width
height: ListView.view.height
Text{
anchors.centerIn: parent
text: model.name
font.bold: true
font.pixelSize: 80
}
}
}
效果:鼠标按下滑动即可切换不同页面