-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMySwip.qml
48 lines (42 loc) · 1.31 KB
/
MySwip.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import QtQuick
import QtQuick.Controls 2.15
import QtQuick 2.15
import QtQuick.Window 2.15
Item {
id: swip
function calculatePrevPage() {
if(swiper.currentIndex === swip.thirdPageNumber)
return swip.thirdPageNumber
if(swiper.currentIndex === swip.firstPageNumber)
return swip.firstPageNumber
}
property color colorBackGround: "#5ccccc"
property int prevPageIndex: calculatePrevPage()
readonly property alias count: swiper.count
readonly property alias currentIndex: swiper.currentIndex
readonly property int firstPageNumber: 0
readonly property int secondPageNumber: 1
readonly property int thirdPageNumber: 2
readonly property int pageAmount: 3
signal indexChanged()
SwipeView {
id: swiper
currentIndex: swip.firstPageNumber
anchors.fill: parent
Repeater {
id: repeater
model: swip.pageAmount
Item {
Rectangle {
anchors.fill: parent
color: swip.colorBackGround
MouseArea {
anchors.fill: parent
onClicked: forceActiveFocus()
}
}
}
}
onCurrentIndexChanged: swip.indexChanged()
}
}