1 import QtQuick 2.11
2 import QtQml.Models 2.11
3
4
5 Rectangle{
6 width: 500
7 height: 500
8
9 ListView{
10 id : listview
11
12 anchors.fill: parent
13 focus: false // 如果为真 接受键盘的左右键的导向
14 15
16 orientation: ListView.Horizontal //横向滑动
17 boundsBehavior: Flickable.StopAtBounds //滑动到边界就停止
18 snapMode: ListView.SnapOneItem //滑动后调整显示一个完整的,移动一页一页地
19
20
21 highlightRangeMode: ListView.StrictlyEnforceRange
22 highlightMoveDuration: 250
23
24 model:ObjectModel{//不需要delegate 的配合
25 Rectangle{//第一个页面显示
26 width: 500
27 height: 500
28
29 color: "blue"
30 }
31
32 Rectangle{//第二个页面显示
33 width: 300
34 height: 300
35
36 color: "green"
37 }
38 }
39
40
41 // delegate:
42 }
43 }