summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/declarative/flickableScrollbar.qml
blob: 147751a3b2bd07b7e3835403ce6225ab7148dabe (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
import Qt 4.7

//![0]
Rectangle {
    width: 200; height: 200

    Flickable {
        id: flickable
//![0]
        anchors.fill: parent
        contentWidth: image.width; contentHeight: image.height

        Image { id: image; source: "pics/qt.png" }
//![1]
    }

    Rectangle {
        id: scrollbar
        anchors.right: flickable.right
        y: flickable.visibleArea.yPosition * flickable.height
        width: 10
        height: flickable.visibleArea.heightRatio * flickable.height
        color: "black"
    }
}
//![1]