aboutsummaryrefslogtreecommitdiff
path: root/modules/system/quickshell/ThinSlider.qml
blob: 61a9ce824440f01125c8155e763cbf46b60f91e7 (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
import QtQuick
import QtQuick.Controls

Slider {
    id: root

    readonly property color colorTrack: Theme.sliderTrack
    readonly property color colorProgress: Theme.accent
    readonly property color colorHandle: Theme.sliderHandle

    implicitHeight: 14
    padding: 0

    background: Rectangle {
        x: root.leftPadding
        y: root.topPadding + root.availableHeight / 2 - height / 2
        implicitWidth: 200
        implicitHeight: 2
        width: root.availableWidth
        height: implicitHeight
        radius: height / 2
        color: root.colorTrack

        Rectangle {
            width: root.handle.x + (root.handle.width / 2)
            height: parent.height
            color: root.colorProgress
            radius: height / 2
        }
    }

    handle: Rectangle {
        x: root.leftPadding + root.visualPosition * (root.availableWidth - width)
        y: root.topPadding + root.availableHeight / 2 - height / 2
        implicitWidth: 2
        implicitHeight: 10
        radius: width / 2
        color: root.colorHandle
    }
}