43 lines
1.1 KiB
QML
43 lines
1.1 KiB
QML
import QtQuick
|
|
import qs.config
|
|
|
|
Rectangle {
|
|
id: root
|
|
|
|
property string text: ""
|
|
property string tone: "normal"
|
|
property bool enabled: true
|
|
signal clicked
|
|
|
|
implicitWidth: label.implicitWidth + 22
|
|
implicitHeight: 31
|
|
radius: 9
|
|
opacity: enabled ? 1 : 0.45
|
|
color: {
|
|
if (tone === "accent")
|
|
return mouse.containsMouse ? Theme.mix(Theme.accent, Theme.fg, 0.12) : Theme.accent;
|
|
return mouse.containsMouse ? Theme.alpha(Theme.fg, 0.13) : Theme.alpha(Theme.fg, 0.075);
|
|
}
|
|
border.width: tone === "accent" ? 0 : 1
|
|
border.color: Theme.alpha(Theme.fg, 0.08)
|
|
|
|
Text {
|
|
id: label
|
|
anchors.centerIn: parent
|
|
text: root.text
|
|
color: root.tone === "accent" ? Theme.bgDark : Theme.fg
|
|
font.family: Theme.fontFamily
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
font.weight: Font.Medium
|
|
}
|
|
|
|
MouseArea {
|
|
id: mouse
|
|
anchors.fill: parent
|
|
enabled: root.enabled
|
|
hoverEnabled: true
|
|
cursorShape: Qt.PointingHandCursor
|
|
onClicked: root.clicked()
|
|
}
|
|
}
|