blob: 7d85e4fce7180e6dabb85132c629022602a1ba93 (
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
|
import qs.components
import qs.components.controls
import qs.components.effects
import qs.config
import QtQuick
import QtQuick.Layouts
StyledRect {
id: root
property color onColor: Colours.palette.m3onSurface
property alias disabled: stateLayer.disabled
property alias text: label.text
property alias enabled: stateLayer.enabled
property string icon: ""
implicitWidth: rowLayout.implicitWidth + Appearance.padding.normal * 2
implicitHeight: rowLayout.implicitHeight + Appearance.padding.small
radius: Appearance.rounding.normal
StateLayer {
id: stateLayer
color: parent.onColor
function onClicked(): void {
if (parent.enabled !== false) {
parent.clicked();
}
}
}
RowLayout {
id: rowLayout
anchors.centerIn: parent
spacing: Appearance.spacing.small
MaterialIcon {
id: iconItem
visible: root.icon.length > 0
text: root.icon
color: root.onColor
font.pointSize: Appearance.font.size.large
}
StyledText {
id: label
Layout.leftMargin: root.icon.length > 0 ? Appearance.padding.smaller : 0
color: parent.parent.onColor
}
}
signal clicked
}
|