QtQuick 左右滑動頁面


 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 }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM