blob: 65952c16d7b0cf0614aa376824b3dfe9e4bdf208 (
plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
import Qt 4.7
Flickable {
id: flickable
property bool selectable: true
property bool indicator: true
interactive: false
boundsBehavior: Flickable.StopAtBounds
flickableDirection: Flickable.VerticalFlick
function scrollDown() {
var maxY = contentHeight - height;
var newContentY = contentY + 96/3;
if (newContentY > maxY) {
contentY = maxY; // Never overscroll.
} else {
contentY = newContentY;
}
}
function scrollUp() {
var newContentY = contentY - 96/3;
if (newContentY < 0) {
contentY = 0; // Never overscroll.
} else {
contentY = newContentY;
}
}
function scrollTop() {
contentY = 0;
}
Rectangle {
id: indicatorCont
visible: flickable.indicator && (flickable.contentHeight > flickable.height)
anchors.top: parent.top
anchors.right: parent.right
anchors.bottom: parent.bottom
width: 4
color: "white"
Rectangle {
id: indicatorRect
property int minHeight: 10
anchors.right: parent.right
anchors.left: parent.left
anchors.leftMargin: 1
y: flickable.visibleArea.yPosition * indicatorCont.height
height: Math.max(minHeight, flickable.visibleArea.heightRatio * indicatorCont.height)
color: "black"
}
}
}
|