blob: 48eee247fb5574dab9dcaeb639009d3a6137279f (
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
67
68
|
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Item {
id: rootItem
property alias sliderValue: slider.value
property alias fromValue: slider.from
property alias toValue: slider.to
property alias sliderEnabled: slider.enabled
property alias sliderStepSize: slider.stepSize
readonly property bool highlight: slider.hovered || slider.pressed
width: 260
height: rowLayout.height
MouseArea {
anchors.fill: parent
onPressed: {}
}
RowLayout {
id: rowLayout
width: parent.width
Slider {
id: slider
from: rootItem.fromValue
to: rootItem.toValue
stepSize: 0.01
Layout.minimumWidth: 200
Layout.fillWidth: true
background: Rectangle {
x: slider.leftPadding
y: slider.topPadding + slider.availableHeight / 2 - height / 2
implicitWidth: 200
implicitHeight: 2
width: slider.availableWidth
height: implicitHeight
color: "#606060"
Rectangle {
width: slider.visualPosition * parent.width
height: parent.height
color: "#41cd52"
}
}
handle: Rectangle {
x: slider.leftPadding + slider.visualPosition * (slider.availableWidth - width)
y: slider.topPadding + slider.availableHeight / 2 - height / 2
implicitWidth: 14
implicitHeight: 14
radius: width/2
color: slider.pressed ? "#ffffff" : "#d0d0d0"
border.color: "#d0d0d0"
}
}
Label {
id: valueText
text: slider.value.toFixed(2)
color: "#f0f0f0"
font.pointSize: 10
font.bold: true
Layout.minimumWidth: 60
}
}
}
|