35 lines
833 B
QML
35 lines
833 B
QML
import QtQuick
|
||
|
||
// Generic stat pill – matches eww stat-pill
|
||
Rectangle {
|
||
id: root
|
||
property string text: ""
|
||
property bool clickable: false
|
||
signal clicked()
|
||
signal rightClicked()
|
||
|
||
implicitWidth: lbl.implicitWidth + 16
|
||
implicitHeight: 22
|
||
radius: 11 // fully rounded pill
|
||
color: "#313244"
|
||
|
||
Text {
|
||
id: lbl
|
||
anchors.centerIn: parent
|
||
text: root.text
|
||
color: "#cdd6f4"
|
||
font.pixelSize: 12
|
||
font.family: "monospace"
|
||
}
|
||
|
||
MouseArea {
|
||
anchors.fill: parent
|
||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||
onClicked: (mouse) => {
|
||
if (mouse.button === Qt.RightButton) root.rightClicked()
|
||
else root.clicked()
|
||
}
|
||
cursorShape: root.clickable ? Qt.PointingHandCursor : Qt.ArrowCursor
|
||
}
|
||
}
|