import QtQuick import "../theme" // Round glyph button used by the media controls and the power tab. Rectangle { id: root property string glyph property string fallback property int size: 36 property real glyphScale: 0.45 property bool accented: false property bool active: false property bool danger: false property bool interactive: true signal clicked implicitWidth: size implicitHeight: size radius: size / 2 opacity: interactive ? 1 : 0.4 color: accented ? (area.pressed ? Theme.accentPressed : area.containsMouse ? Theme.accentHover : Theme.accent) : danger && area.containsMouse ? Qt.alpha("#ff5f57", 0.85) : active ? Qt.alpha(Theme.accent, 0.28) : area.containsMouse ? Theme.hover : Theme.fill border.width: accented ? 0 : 1 border.color: active ? Qt.alpha(Theme.accent, 0.6) : Theme.hairline scale: area.pressed ? 1 - 0.06 * Theme.intensity : 1 Behavior on color { ColorAnimation { duration: Theme.duration / 2 } } Behavior on scale { NumberAnimation { duration: Theme.duration / 2 easing.type: Easing.OutCubic } } Text { anchors.centerIn: parent text: Icons.available && root.glyph ? root.glyph : root.fallback font.family: Icons.available && root.glyph ? Icons.family : "" font.pixelSize: Math.round(root.size * root.glyphScale) color: root.accented ? Theme.accentText : root.active ? Theme.accentVivid : Theme.text } MouseArea { id: area anchors.fill: parent hoverEnabled: true enabled: root.interactive cursorShape: Qt.PointingHandCursor onClicked: root.clicked() } Accessible.role: Accessible.Button }