aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/quickcontrols/gifs/data/qtquickcontrols-slider-snap.qml
blob: ae5d8cf6cb0b33c62c39155a33112804e03d3af4 (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
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick
import QtQuick.Window
import QtQuick.Controls

Window {
    width: slider.implicitWidth
    height: slider.implicitHeight
    visible: true

    property alias slider: slider

    Slider {
        id: slider
        stepSize: 0.2
        anchors.centerIn: parent

        Rectangle {
            anchors.fill: slider.handle
            radius: width / 2
            color: slider.pressed ? "#aa666666" : "transparent"
        }

        contentItem: Item {
            Repeater {
                id: repeater
                model: 6

                Rectangle {
                    x: ((slider.contentItem.width - slider.handle.width) * (index / (repeater.count - 1)))
                       - width / 2 + slider.handle.width / 2
                    y: parent.height
                    width: 1
                    height: 4
                    color: "#888"
                }
            }
        }
    }
}