blob: af0d5d67ed45c2e6f3e7ccd09d305c54d31e8ea2 (
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
|
import QtQuick
import qs.Common
import qs.Widgets
Rectangle {
id: root
property int count: 0
property string label: ""
property string iconName: ""
property color iconColor: Theme.surfaceText
property color bgColor: Theme.surfaceContainerHigh
property bool selected: false
signal clicked
height: Math.round(Theme.fontSizeMedium * 5)
radius: Theme.cornerRadius
color: bgColor
border.width: selected ? 2 : 0
border.color: selected ? iconColor : "transparent"
scale: mouseArea.pressed ? 0.97 : 1
Behavior on scale {
NumberAnimation {
duration: Theme.shortDuration
easing.type: Theme.emphasizedEasing
}
}
Behavior on border.width {
NumberAnimation {
duration: Theme.shortDuration
}
}
MouseArea {
id: mouseArea
anchors.fill: parent
cursorShape: Qt.PointingHandCursor
onClicked: root.clicked()
}
Column {
anchors.centerIn: parent
spacing: Theme.spacingXS
Row {
anchors.horizontalCenter: parent.horizontalCenter
spacing: Theme.spacingS
DankIcon {
name: root.iconName
size: Theme.iconSize - 4
color: root.iconColor
anchors.verticalCenter: parent.verticalCenter
}
StyledText {
text: root.count.toString()
font.pixelSize: Theme.fontSizeXLarge
font.weight: Font.Bold
color: root.iconColor
anchors.verticalCenter: parent.verticalCenter
}
}
StyledText {
text: root.label
font.pixelSize: Theme.fontSizeSmall
color: Theme.surfaceText
anchors.horizontalCenter: parent.horizontalCenter
}
}
}
|