Krolyxon
Commit 85941a2

Branches

Refs →

aurora.configquickshellwal-controlListRow.qml

72 lines · 2.0 KB · QML

1import QtQuick
2import QtQuick.Layouts
3
4Rectangle {
5 id: r
6 property string icon: ""
7 property string title: ""
8 property string subtitle: ""
9 property string trailing: ""
10 property bool current: false
11 signal clicked()
12 // anything declared inside a ListRow{} lands in the right-hand slot
13 default property alias extra: extraRow.data
14
15 Layout.fillWidth: true
16 implicitHeight: 42
17 color: m.containsMouse ? Theme.surfaceHi : (current ? Theme.surface : "transparent")
18 border.width: current ? 1 : 0
19 border.color: Theme.accent
20
21 MouseArea {
22 id: m
23 anchors.fill: parent
24 hoverEnabled: true
25 cursorShape: Qt.PointingHandCursor
26 onClicked: r.clicked()
27 }
28
29 RowLayout {
30 anchors.fill: parent
31 anchors.leftMargin: 10
32 anchors.rightMargin: 6
33 spacing: 10
34
35 Text {
36 text: r.icon
37 color: r.current ? Theme.accent : Theme.fg
38 font.family: Theme.font
39 font.pixelSize: 17
40 }
41 ColumnLayout {
42 Layout.fillWidth: true
43 spacing: 0
44 Text {
45 text: r.title
46 Layout.fillWidth: true
47 elide: Text.ElideRight
48 color: Theme.fg
49 font.family: Theme.font
50 font.pixelSize: Theme.fontSize
51 font.bold: r.current
52 }
53 Text {
54 visible: r.subtitle !== ""
55 text: r.subtitle
56 Layout.fillWidth: true
57 elide: Text.ElideRight
58 color: r.current ? Theme.accent : Theme.dim
59 font.family: Theme.font
60 font.pixelSize: Theme.fontSize - 3
61 }
62 }
63 Text {
64 visible: r.trailing !== ""
65 text: r.trailing
66 color: Theme.dim
67 font.family: Theme.font
68 font.pixelSize: Theme.fontSize - 2
69 }
70 Row { id: extraRow; spacing: 4 }
71 }
72}