aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quickcontrols2/qquickcontrol/data/resizeBackgroundKeepsBindings.qml
blob: 9a6a159990ba336670cffdaf06f55cace52489d0 (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
import QtQuick 2.15
import QtQuick.Controls 2.15

ApplicationWindow {
    width: 640
    height: 80
    visible: true

    Slider {
        id: control
        value: 0.5
        anchors.fill: parent

        background: Rectangle {
            id: background
            x: control.leftPadding
            y: control.topPadding + control.availableHeight / 2 - height / 2
            implicitHeight: 4
            width: control.availableWidth
            height: implicitHeight
            radius: 2
            color: "#bdbebf"

            Rectangle {
                width: control.visualPosition * parent.width
                height: parent.height
                color: "#21be2b"
                radius: 2
            }
        }

        handle: Rectangle {
            x: control.leftPadding + control.visualPosition * (control.availableWidth - width)
            y: control.topPadding + control.availableHeight / 2 - height / 2
            implicitWidth: 26
            implicitHeight: 26
            radius: 13
            color: control.pressed ? "#f0f0f0" : "#f6f6f6"
            border.color: "#bdbebf"
        }
    }
}