blob: 816f9f0e4b27be8e44404d5a437add9fe752adfa (
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
import QtQuick
import QtQuick.Controls.Basic
Slider {
// Height, width and any other size related properties containing odd looking float or other dividers
// that do not seem to have any logical origin are just arbitrary and based on original design
// and/or personal preference on what looks nice.
id: slider
property int liquidAmount: 0
property alias box: box
property alias liquidAmountText: liquidAmountText
states: State {
name: "pressed"
when: slider.pressed
PropertyChanges {
target: handle
scale: 1.1
}
}
transitions: Transition {
NumberAnimation {
properties: "scale"
duration: 10
easing.type: Easing.InOutQuad
}
}
background: Rectangle {
id: rectangle
x: slider.leftPadding
anchors.verticalCenter: parent.verticalCenter
width: slider.availableWidth
height: 4
radius: 2
color: Colors.grey
Rectangle {
width: slider.visualPosition * parent.width
height: parent.height
color: Colors.green
radius: 2
}
}
handle: Rectangle {
id: handle
x: slider.leftPadding + slider.visualPosition * (slider.availableWidth - width)
anchors.verticalCenter: parent.verticalCenter
width: 14
height: width
radius: 100
color: Colors.green
Image {
id: handleMark
source: "./images/icons/Polygon.svg"
anchors.bottom: parent.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: 1
}
Rectangle {
id: box
anchors.bottom: handleMark.top
anchors.horizontalCenter: parent.horizontalCenter
anchors.bottomMargin: 1
implicitWidth: liquidAmountText.width + 8
implicitHeight: liquidAmountText.height + 4
radius: 4
color: Colors.currentTheme.background
border.color: Colors.grey
Text {
id: liquidAmountText
anchors.verticalCenter: parent.verticalCenter
anchors.horizontalCenter: parent.horizontalCenter
text: liquidAmount + "ml"
font.pixelSize: 12
clip: false
color: Colors.currentTheme.textColor
}
}
}
}
|