aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/doc/snippets/qml/flickableScrollbar.qml
blob: 981b725313eda2453713ba364fbfc8d863f9b6f2 (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
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick

//![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]