blob: f4dcf5a16ca18f82083d912b67723a3da49ab036 (
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
|
import QtCore
import QtQuick
import qs.Common
Column {
id: root
property string text: ""
property var incrementTooltipText: ""
property var decrementTooltipText: ""
property var onIncrement: undefined
property var onDecrement: undefined
property string incrementIconName: "keyboard_arrow_up"
property string decrementIconName: "keyboard_arrow_down"
property bool incrementEnabled: true
property bool decrementEnabled: true
property color textColor: Theme.surfaceText
property color iconColor: Theme.withAlpha(Theme.surfaceText, 0.5)
property color backgroundColor: Theme.primary
property int textSize: Theme.fontSizeSmall
property var iconSize: 12
property int buttonSize: 20
property int horizontalPadding: Theme.spacingL
readonly property bool effectiveIncrementEnabled: root.onIncrement ? root.incrementEnabled : false
readonly property bool effectiveDecrementEnabled: root.onDecrement ? root.decrementEnabled : false
width: Math.max(buttonSize * 2, root.implicitWidth + horizontalPadding * 2)
spacing: 4
DankActionButton {
anchors.horizontalCenter: parent.horizontalCenter
enabled: root.effectiveIncrementEnabled
iconColor: root.effectiveIncrementEnabled ? root.iconColor : Theme.blendAlpha(root.iconColor, 0.5)
iconSize: root.iconSize
buttonSize: root.buttonSize
iconName: root.incrementIconName
onClicked: if (typeof root.onIncrement === 'function') root.onIncrement()
tooltipText: root.incrementTooltipText
}
Row {
anchors.horizontalCenter: parent.horizontalCenter
Item { width: 5; height: 1 }
StyledText {
isMonospace: true
text: root.text
font.pixelSize: root.textSize
color: root.textColor
}
Item { width: 5; height: 1 }
}
DankActionButton {
anchors.horizontalCenter: parent.horizontalCenter
enabled: root.effectiveDecrementEnabled
iconColor: root.effectiveDecrementEnabled ? root.iconColor : Theme.blendAlpha(root.iconColor, 0.5)
iconSize: root.iconSize
buttonSize: root.buttonSize
iconName: root.decrementIconName
onClicked: if (typeof root.onDecrement === 'function') root.onDecrement()
tooltipText: root.decrementTooltipText
}
}
|