SwipeView
- 用户可以通过侧向滑动来浏览界面
- 属性
horizontal : 保存滑动视图是否为水平
interactive : 描述用户是否可以与SwipeView进行交互,设置为true则用户无法滑动
orientation : 保留方向
vertical : 保存滑动视图是否垂直
- 附加属性
index : 保存SwipeView中每个子项的索引
isCurrentItem : 若子项为当前项,则此属性为true
isNextItem : 若子项是下一个项目,则此属性为true
isPreviousItem : 若子项是上一个项目,则此属性为true
view : 包含管理此子项的视图
- 例1 填充一组矩形

import QtQuick 2.9
import QtQuick.Window 2.2
import QtQuick.Controls 2.2
Window {
visible: true
width: 640
height: 480
title: qsTr("test")
SwipeView {
id: view
currentIndex: 0
anchors.fill: parent
orientation: Qt.Horizontal //水平方向 即左右滑动
interactive: true //交互式 默认true false表示不能通过滑动切换页面
Rectangle {
id: firstPage
color: "purple"
Text {
text: qsTr("First")
anchors.centerIn: parent
font.pixelSize: 25
}
}
Rectangle {
id: secondPage
color: "blue"
Text {
text: qsTr