• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
Kevin Cheng's Yard
电脑是我的老婆,编程是我的灵魂,代码是我的语言,按键是我在歌唱。
https://github.com/surfsky/
博客园    首页    新随笔    联系   管理    订阅  订阅

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 }

 

转载请注明出处:http://surfsky.cnblogs.com 

posted @ 2015-03-20 09:38  surfsky  阅读(7112)  评论(2)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3