import QtQuick import QtQuick.Controls import "../theme" Button { id: root property bool accented: false implicitWidth: Math.max(40, label.implicitWidth + 28) implicitHeight: 36 hoverEnabled: true transform: Translate { y: root.hovered && !root.down ? -Theme.intensity : 0 Behavior on y { NumberAnimation { duration: Theme.duration / 2 easing.type: Easing.OutCubic } } } scale: down ? 1 - 0.04 * Theme.intensity : 1 Behavior on scale { NumberAnimation { duration: Theme.duration / 2 easing.type: Easing.OutCubic } } contentItem: Text { id: label text: root.text color: root.accented ? (root.down ? Theme.accentPressedText : root.hovered ? Theme.accentHoverText : Theme.accentText) : Theme.text font.pixelSize: 13 horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } background: Rectangle { radius: height / 2 color: root.accented ? (root.down ? Theme.accentPressed : root.hovered ? Theme.accentHover : Theme.accent) : root.hovered ? Theme.hover : Theme.surfaceVariant border.width: root.activeFocus ? 2 : 1 border.color: root.activeFocus ? Theme.accent : Theme.border Behavior on color { ColorAnimation { duration: Theme.duration } } } opacity: enabled ? 1 : 0.45 }