Krolyxon
Commit d48166e

Branches

Refs →

aurora.configquickshellauroraIconBtn.qml

46 lines · 1.2 KB · QML

1import QtQuick
2
3Rectangle {
4 id: b
5 property string icon: ""
6 property string label: ""
7 property bool active: false
8 property int iconSize: 15
9 signal clicked()
10
11 implicitWidth: Math.max(30, content.implicitWidth + 16)
12 implicitHeight: 30
13 color: active ? Theme.accent : (m.containsMouse ? Theme.surfaceHi : "transparent")
14 border.width: 1
15 border.color: (active || m.containsMouse) ? Theme.accent : Theme.line
16
17 Row {
18 id: content
19 anchors.centerIn: parent
20 spacing: 6
21 Text {
22 visible: b.icon !== ""
23 text: b.icon
24 color: b.active ? Theme.bg : Theme.fg
25 font.family: Theme.font
26 font.pixelSize: b.iconSize
27 anchors.verticalCenter: parent.verticalCenter
28 }
29 Text {
30 visible: b.label !== ""
31 text: b.label
32 color: b.active ? Theme.bg : Theme.fg
33 font.family: Theme.font
34 font.pixelSize: Theme.fontSize - 1
35 anchors.verticalCenter: parent.verticalCenter
36 }
37 }
38
39 MouseArea {
40 id: m
41 anchors.fill: parent
42 hoverEnabled: true
43 cursorShape: Qt.PointingHandCursor
44 onClicked: b.clicked()
45 }
46}