aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qmldesigner/data/merging/SliderTemplate.qml
blob: f78a00ef66545e0089736b2e527249cfcab172e8 (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
64
65
66
import QtQuick 2.6
import QtQuick.Controls 2.0

Slider {
    id: control
    value: 0.5

    background: Item {
        x: control.leftPadding
        y: control.topPadding + control.availableHeight / 2 - height / 2
        implicitWidth: sliderGroove.width
        implicitHeight: sliderGroove.height
        height:  implicitHeight
        width: control.availableWidth
        Rectangle {
            id: sliderGroove

            width: 200
            height: 4

            anchors.fill: parent // has to be preserved
            radius: 2
            color: "#bdbebf"
        }

        Item {
            width: control.visualPosition * sliderGroove.width // should be preserved
            height: sliderGrooveLeft.height
            clip: true

            Rectangle {
                id: sliderGrooveLeft
                width: 200
                height: 4
                color: "#21be2b"
                radius: 2
            }
        }
    }

    handle: Item {
        x: control.leftPadding + control.visualPosition * (control.availableWidth - width)
        y: control.topPadding + control.availableHeight / 2 - height / 2

        implicitWidth: handleNormal.width
        implicitHeight: handleNormal.height
        Rectangle {
            id: handleNormal
            width: 26
            height: 26
            radius: 13
            color: "#f6f6f6"
            visible: !control.pressed //has to be preserved
            border.color: "#bdbebf"
        }
        Rectangle {
            id: handlePressed
            width: 26
            height: 26
            radius: 13
            visible: control.pressed //has to be preserved
            color:  "#f0f0f0"
            border.color: "#bdbebf"
        }
    }
}