qml 滑动导航模型SwipeView 页面指示符PageIndicator

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
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值