c622a4cc23
- Add RailActionButton reusable side-rail button component - Add AboutDialog popup component - Register new types in qmldir files - Register TransportBar in components qmldir
71 lines
1.8 KiB
QML
71 lines
1.8 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Controls.impl
|
|
import ISC
|
|
|
|
// ===== Rail Action Button =====
|
|
// Reusable pill-style button for rail action panels.
|
|
// Icon left, uppercase label, fixed height, hover/active backgrounds.
|
|
Rectangle {
|
|
id: root
|
|
|
|
property string label: ""
|
|
property string iconSource: ""
|
|
property bool destructive: false
|
|
property color _textColor: !root.enabled ? Theme.sideMutedText
|
|
: root.destructive ? Theme.statusErrorColor
|
|
: Theme.headingColor
|
|
|
|
signal clicked()
|
|
|
|
implicitHeight: Theme.sideButtonHeight
|
|
radius: 8
|
|
color: mouseArea.containsMouse || mouseArea.pressed
|
|
? Theme.sideActiveBackground : "transparent"
|
|
border.width: 0
|
|
|
|
Behavior on color {
|
|
ColorAnimation { duration: 100 }
|
|
}
|
|
|
|
Row {
|
|
anchors.fill: parent
|
|
anchors.leftMargin: 12
|
|
anchors.rightMargin: 12
|
|
spacing: 10
|
|
|
|
IconImage {
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
width: 18
|
|
height: 18
|
|
source: root.iconSource
|
|
sourceSize.width: 18
|
|
sourceSize.height: 18
|
|
color: root._textColor
|
|
opacity: root.enabled ? 0.85 : 0.35
|
|
}
|
|
|
|
Label {
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
text: root.label
|
|
color: root._textColor
|
|
font.family: Theme.uiFontFamily
|
|
font.pixelSize: Theme.fontSm
|
|
font.bold: true
|
|
font.letterSpacing: 1.2
|
|
opacity: root.enabled ? 1.0 : 0.4
|
|
elide: Text.ElideRight
|
|
}
|
|
}
|
|
|
|
MouseArea {
|
|
id: mouseArea
|
|
anchors.fill: parent
|
|
hoverEnabled: root.enabled
|
|
cursorShape: root.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
|
|
onClicked: {
|
|
if (root.enabled) root.clicked()
|
|
}
|
|
}
|
|
}
|