summaryrefslogtreecommitdiffstats
path: root/weather-qml/ScrollBar.qml
blob: 2361c32b5913d8bc556afcef361f5d7802201029 (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
import Qt 4.6

Item {
    id: scrollBar

    property real position
    property real pageSize

    Rectangle {
        id: background
        anchors.fill: parent
        opacity: 0.3
        color: "white"
        radius: (width / 2 - 1)
    }

    Rectangle {
        opacity: 0.7
        color: "black"
        radius: (width / 2 - 1)
        x: 1
        y: Math.min(Math.max(0.0, scrollBar.position),
                    Math.max(0.0, 1.0 - scrollBar.pageSize)) * (scrollBar.height - 2) + 1
        width: parent.width - 2
        height: Math.min(1.0, scrollBar.pageSize) * (scrollBar.height - 2)
    }
}