Files
wehub-resource-sync ead81af521
Deploy to GitHub Pages / deploy (push) Failing after 0s
CI / go (push) Has been cancelled
CI / build (darwin, macos-14) (push) Has been cancelled
CI / build (windows, windows-2025) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:31:13 +08:00

44 lines
1.3 KiB
QML

// Borderless transport button with hover color shift, drawing a MediaIcon
// instead of a font glyph. shape: "prev" | "play" | "pause" | "next" | "stop".
import QtQuick
Item {
id: root
property string shape: "play"
property color fgColor: "#d4be98"
property color hoverColor: "#d8a657"
property bool enabled: true
property real iconSize: 14
property string accessibleName: shape
signal activated()
property bool hovered: false
implicitWidth: iconSize + 12
implicitHeight: iconSize + 8
activeFocusOnTab: enabled
Accessible.role: Accessible.Button
Accessible.name: accessibleName
Accessible.onPressAction: if (root.enabled) root.activated()
Keys.onSpacePressed: if (root.enabled) root.activated()
Keys.onReturnPressed: if (root.enabled) root.activated()
MediaIcon {
anchors.centerIn: parent
shape: root.shape
size: root.iconSize
color: root.hovered && root.enabled ? root.hoverColor : root.fgColor
opacity: root.enabled ? 1.0 : 0.35
}
MouseArea {
anchors.fill: parent
hoverEnabled: true
cursorShape: root.enabled ? Qt.PointingHandCursor : Qt.ArrowCursor
onEntered: root.hovered = true
onExited: root.hovered = false
onClicked: { if (root.enabled) root.activated() }
}
}