From 13841f959dbd682ca150c4ffebdb4d8ee1a0307c Mon Sep 17 00:00:00 2001 From: quadbyte Date: Mon, 11 Aug 2025 13:35:09 -0400 Subject: [PATCH] NToggle: support for different size --- Widgets/NToggle.qml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Widgets/NToggle.qml b/Widgets/NToggle.qml index 3318bf8..55eb098 100644 --- a/Widgets/NToggle.qml +++ b/Widgets/NToggle.qml @@ -11,6 +11,7 @@ RowLayout { property string description: "" property bool value: false property bool hovering: false + property int baseSize: Style.baseWidgetSize property var onToggled: function (value) {} Layout.fillWidth: true @@ -38,16 +39,16 @@ RowLayout { Rectangle { id: switcher - width: Style.baseWidgetSize * 1.625 * scaling - height: Style.baseWidgetSize * scaling + width: root.baseSize * 1.625 * scaling + height: root.baseSize * scaling radius: height * 0.5 color: value ? Colors.accentPrimary : Colors.surfaceVariant border.color: value ? Colors.accentPrimary : Colors.outline border.width: Math.max(1, Style.borderMedium * scaling) Rectangle { - width: (Style.baseWidgetSize - 4) * scaling - height: (Style.baseWidgetSize - 4) * scaling + width: (root.baseSize - 4) * scaling + height: (root.baseSize - 4) * scaling radius: height * 0.5 color: Colors.surface border.color: hovering ? Colors.textDisabled : Colors.outline