/* * SPDX-FileCopyrightText: 2026 enne2 * SPDX-License-Identifier: MIT * * Pillola selezionabile usata per governor ed EPP: alternativa compatta a una * ComboBox, senza stato interno (attivo/inattivo derivano dalle proprietà). */ import QtQuick import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.kirigami as Kirigami Rectangle { id: pill property string text: "" property bool active: false property color accent: "#55c5c0" signal clicked() implicitWidth: label.implicitWidth + 16 implicitHeight: label.implicitHeight + 8 radius: 4 color: active ? Qt.rgba(accent.r, accent.g, accent.b, 0.22) : (pillMouse.containsMouse ? Qt.rgba(1, 1, 1, 0.10) : Qt.rgba(1, 1, 1, 0.05)) border.width: 1 border.color: active ? Qt.rgba(accent.r, accent.g, accent.b, 0.8) : Qt.rgba(1, 1, 1, 0.10) opacity: enabled ? 1.0 : 0.5 Behavior on color { ColorAnimation { duration: 120 } } PlasmaComponents.Label { id: label anchors.centerIn: parent text: pill.text font.family: "monospace" font.pointSize: 8 font.bold: pill.active color: pill.active ? pill.accent : Kirigami.Theme.textColor opacity: pill.active ? 1.0 : 0.78 } MouseArea { id: pillMouse anchors.fill: parent hoverEnabled: true cursorShape: Qt.PointingHandCursor onClicked: pill.clicked() } }