Qt qml pageview 左右滑动分页组件

【先看效果】

【下载】
http://download.csdn.net/detail/surfsky/8516949

【调用】
复制代码
 1 分页视图
 2     左右分页滑动列表组件
 3 示例
 4     PageView{
 5         id: pv
 6         width: 300
 7         height: 200
 8         Rectangle{
 9             width:pv.width; height:pv.height;
10             color: 'red'
11         }
12         Rectangle{
13             width:pv.width; height:pv.height;
14             color: 'green'
15         }
16         Rectangle{
17             width:pv.width; height:pv.height;
18             color: 'blue'
19         }
20     }
21 Author: surfsky.cnblogs.com 2014-12
22 Lisence: MIT 请保留此段声明
复制代码

 

【核心代码】
复制代码
 1 ListView{
 2     id: root
 3     width: 500
 4     height: 500
 5     model: pageModel
 6 
 7     // 可视元素模型(直接输出可视元素)
 8     default property alias content: pageModel.children
 9     VisualItemModel {id: pageModel}
10 
11     // 横向、只显示一个
12     orientation: ListView.Horizontal
13     snapMode: ListView.SnapOneItem
14     highlightRangeMode: ListView.StrictlyEnforceRange
15     cacheBuffer: 3
16     boundsBehavior: Flickable.StopAtBounds
17 
18     // 当前页指示器
19     ListViewIndicator{
20         target : root
21         anchors.horizontalCenter: parent.horizontalCenter
22         anchors.bottom: parent.bottom
23         anchors.bottomMargin: 5
24         z: 2
25     }
26 }
复制代码

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值