51 lines
1.3 KiB
QML
51 lines
1.3 KiB
QML
import QtQuick
|
|
import qs.config
|
|
|
|
Item {
|
|
id: root
|
|
|
|
property string label: ""
|
|
property string action: ""
|
|
property bool actionEnabled: true
|
|
signal actionTriggered
|
|
|
|
implicitHeight: 24
|
|
|
|
Text {
|
|
anchors.left: parent.left
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
text: root.label.toUpperCase()
|
|
color: Theme.fgMuted
|
|
font.family: Theme.fontFamily
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
font.weight: Font.DemiBold
|
|
font.letterSpacing: 0.9
|
|
}
|
|
|
|
Text {
|
|
id: actionLabel
|
|
anchors.right: parent.right
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
visible: root.action !== ""
|
|
text: root.action
|
|
color: root.actionEnabled
|
|
? (actionMouse.containsMouse ? Theme.accentAlt : Theme.accent)
|
|
: Theme.fgMuted
|
|
font.family: Theme.fontFamily
|
|
font.pixelSize: Theme.fontSizeSmall
|
|
font.weight: Font.Medium
|
|
|
|
Behavior on color { ColorAnimation { duration: Theme.durFast } }
|
|
|
|
MouseArea {
|
|
id: actionMouse
|
|
anchors.fill: parent
|
|
anchors.margins: -6
|
|
enabled: root.actionEnabled
|
|
hoverEnabled: true
|
|
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
onClicked: root.actionTriggered()
|
|
}
|
|
}
|
|
}
|