Krolyxon
Commit af47ed6

Branches

Refs →

aurora.configquickshellauroraListRow.qml

86 lines · 2.3 KB · QML

1import QtQuick
2import QtQuick.Layouts
3
4// A list row: icon in a circle (white when `current`: connected, default device...), title over a caps sub line,
5// a caps trailing value. Anything declared inside a ListRow {} lands in the right-hand slot (small round buttons).
6Rectangle {
7 id: r
8 property string icon: ""
9 property string title: ""
10 property string subtitle: ""
11 property string trailing: ""
12 property bool current: false
13 signal clicked()
14 default property alias extra: extraRow.data
15
16 Layout.fillWidth: true
17 implicitHeight: 56
18 radius: height / 2
19 color: m.containsMouse ? Theme.s2 : "transparent"
20
21 MouseArea {
22 id: m
23 anchors.fill: parent
24 hoverEnabled: true
25 cursorShape: Qt.PointingHandCursor
26 onClicked: r.clicked()
27 }
28
29 Rectangle {
30 id: ic
31 x: 6
32 anchors.verticalCenter: parent.verticalCenter
33 width: 44
34 height: 44
35 radius: 22
36 color: r.current ? Theme.fill : (m.containsMouse ? Theme.s3 : Theme.s2)
37 Icon {
38 anchors.centerIn: parent
39 text: r.icon
40 font.pixelSize: 19
41 color: r.current ? Theme.fillFg : Theme.fg
42 }
43 }
44 Column {
45 anchors.left: ic.right
46 anchors.leftMargin: 14
47 anchors.right: tail.left
48 anchors.rightMargin: 10
49 anchors.verticalCenter: parent.verticalCenter
50 spacing: 2
51 Text {
52 width: parent.width
53 elide: Text.ElideRight
54 text: r.title
55 font.family: Theme.ui
56 font.pixelSize: 15
57 font.weight: Font.DemiBold
58 color: Theme.fg
59 }
60 Lb {
61 visible: r.subtitle !== ""
62 width: parent.width
63 elide: Text.ElideRight
64 text: r.subtitle
65 px: 10
66 }
67 }
68 Row {
69 id: tail
70 anchors.right: parent.right
71 anchors.rightMargin: 10
72 anchors.verticalCenter: parent.verticalCenter
73 spacing: 8
74 Lb {
75 visible: r.trailing !== ""
76 anchors.verticalCenter: parent.verticalCenter
77 text: r.trailing
78 px: 10
79 }
80 Row {
81 id: extraRow
82 anchors.verticalCenter: parent.verticalCenter
83 spacing: 6
84 }
85 }
86}