From ddde4b30c458516313bea9df48c592ef5df29701 Mon Sep 17 00:00:00 2001 From: quadbyte Date: Wed, 13 Aug 2025 15:56:27 -0400 Subject: [PATCH] NRadioButton: New widget --- Widgets/NRadioButton.qml | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 Widgets/NRadioButton.qml diff --git a/Widgets/NRadioButton.qml b/Widgets/NRadioButton.qml new file mode 100644 index 0000000..06e9098 --- /dev/null +++ b/Widgets/NRadioButton.qml @@ -0,0 +1,44 @@ +import QtQuick +import QtQuick.Controls +import qs.Services +import qs.Widgets + +RadioButton { + id: root + + indicator: Rectangle { + id: outerCircle + + implicitWidth: 20 * scaling + implicitHeight: 20 * scaling + radius: width * 0.5 + color: "transparent" + border.color: root.checked ? Colors.accentPrimary : Colors.textPrimary + border.width: 2 + anchors.verticalCenter: parent.verticalCenter + + Rectangle { + anchors.centerIn: parent + implicitWidth: Style.marginSmall * scaling + implicitHeight: Style.marginSmall * scaling + + radius: width * 0.5 + color: Qt.alpha(Colors.accentPrimary, root.checked ? 1 : 0) + } + + Behavior on border.color { + ColorAnimation { + duration: Style.animationNormal + easing.type: Easing.InQuad + } + } + } + + contentItem: NText { + text: root.text + font.pointSize: Style.fontSizeMedium * scaling + anchors.verticalCenter: parent.verticalCenter + anchors.left: outerCircle.right + anchors.leftMargin: Style.marginSmall * scaling + } +}