import QtQuick Item { id: root property string label: "" property bool active: false property bool danger: false readonly property bool hovered: hover.containsMouse readonly property color iconColor: { if (danger && hovered) return Theme.danger if (active) return Theme.accentStrong if (hovered) return Theme.textPrimary return Theme.textSecondary } default property alias icon: iconHolder.data signal clicked() implicitWidth: Theme.controlHeight implicitHeight: Theme.controlHeight Accessible.role: Accessible.Button Accessible.name: root.label Accessible.onPressAction: root.clicked() Rectangle { anchors.fill: parent radius: Theme.radiusSmall color: { if (root.active) return Theme.accentSoft if (hover.containsMouse) return Theme.hoverFill return "transparent" } Behavior on color { ColorAnimation { duration: Theme.animationFast } } } Item { id: iconHolder anchors.centerIn: parent width: 16 height: 16 } MouseArea { id: hover anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: root.clicked() } FocusFrame { radius: Theme.radiusSmall } }