Files
stilobique b1ca2a7cff
CI / Release Gitea (push) Successful in 32s
CI / Vérifications et paquet (push) Successful in 47s
Refactoring: move all apps inside a sub folder
2026-11-08 14:28:28 +01:00

48 lines
1.3 KiB
QML

import QtQuick 2.5
import "../Shared"
import "../Shared/Remote.js" as Remote
// Bouton navigable à la télécommande : surbrillance blanche quand il a le focus.
Rectangle {
id: root
property alias text: label.text
property bool primary: false
signal clicked()
implicitWidth: Math.max(160, label.implicitWidth + Theme.spacingL * 2)
implicitHeight: Theme.controlHeight
radius: Theme.radius
opacity: enabled ? 1 : 0.5
color: activeFocus ? Theme.focusBackground : (primary ? Theme.accent : Theme.surface)
scale: activeFocus ? 1.05 : 1
Behavior on scale { NumberAnimation { duration: Theme.animFast } }
Behavior on color { ColorAnimation { duration: Theme.animFast } }
Text {
id: label
anchors.centerIn: parent
color: root.activeFocus ? Theme.textOnFocus : Theme.text
font.pixelSize: Theme.fontBody
font.bold: root.activeFocus
}
Keys.onPressed: {
if (Remote.isAccept(event.key)) {
event.accepted = true;
root.clicked();
}
}
// Souris : pratique pour tester hors de la box.
MouseArea {
anchors.fill: parent
enabled: root.enabled
onClicked: {
root.forceActiveFocus();
root.clicked();
}
}
}