Files
dotfiles/.config/quickshell/Pill.qml
T

40 lines
1.1 KiB
QML

// Pill.qml - styled module container
import QtQuick
import QtQuick.Layouts
Rectangle {
id: root
default property alias content: inner.data
property bool hovered: mouseArea.containsMouse
signal clicked(var mouse)
signal scrolled(var wheel)
property real leftPadding: Theme.pillPadH
property real rightPadding: Theme.pillPadH
implicitWidth: inner.implicitWidth + leftPadding + rightPadding
implicitHeight: Theme.barHeight
radius: Theme.radius
color: hovered ? Theme.pillHover : Theme.pill
Behavior on color { ColorAnimation { duration: 150 } }
RowLayout {
id: inner
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
anchors.leftMargin: root.leftPadding
spacing: 4
}
MouseArea {
id: mouseArea
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton | Qt.MiddleButton
onClicked: (m) => root.clicked(m)
onWheel: (w) => root.scrolled(w)
}
}