From b163dab2419680099f19e44b8c23ea644c6a7066 Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Sun, 14 Sep 2025 12:03:15 -0400 Subject: [PATCH] NCheckbox+NToggle: better look --- Widgets/NCheckbox.qml | 11 ++++++----- Widgets/NToggle.qml | 14 +++++++------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Widgets/NCheckbox.qml b/Widgets/NCheckbox.qml index d9c23a3..b9c2ae6 100644 --- a/Widgets/NCheckbox.qml +++ b/Widgets/NCheckbox.qml @@ -13,7 +13,7 @@ RowLayout { property bool hovering: false property color activeColor: Color.mPrimary property color activeOnColor: Color.mOnPrimary - property int baseSize: Math.max(Style.baseWidgetSize * 0.7, 14) + property int baseSize: Style.baseWidgetSize * 0.7 signal toggled(bool checked) signal entered @@ -35,12 +35,12 @@ RowLayout { Rectangle { id: box - implicitWidth: root.baseSize * scaling - implicitHeight: root.baseSize * scaling + implicitWidth: Math.round(root.baseSize * scaling) + implicitHeight: Math.round(root.baseSize * scaling) radius: Style.radiusXS * scaling color: root.checked ? root.activeColor : Color.mSurface border.color: Color.mOutline - border.width: Math.max(1, Style.borderM * scaling) + border.width: Math.max(1, Style.borderS * scaling) Behavior on color { ColorAnimation { @@ -60,7 +60,8 @@ RowLayout { anchors.horizontalCenterOffset: -1 * scaling icon: "check" color: root.activeOnColor - font.pointSize: Math.max(Style.fontSizeXS, root.baseSize * 0.6) * scaling + font.pointSize: Math.max(Style.fontSizeXS, root.baseSize * 0.5) * scaling + font.weight: Style.fontWeightBold } MouseArea { diff --git a/Widgets/NToggle.qml b/Widgets/NToggle.qml index 35413cd..f283e18 100644 --- a/Widgets/NToggle.qml +++ b/Widgets/NToggle.qml @@ -11,7 +11,7 @@ RowLayout { property string description: "" property bool checked: false property bool hovering: false - property int baseSize: Style.baseWidgetSize * 0.8 + property int baseSize: Math.round(Style.baseWidgetSize * 0.8) signal toggled(bool checked) signal entered @@ -27,12 +27,12 @@ RowLayout { Rectangle { id: switcher - implicitWidth: root.baseSize * 1.625 * scaling - implicitHeight: root.baseSize * scaling + implicitWidth: Math.round(root.baseSize * 1.625 * scaling) + implicitHeight: Math.round(root.baseSize * scaling) radius: height * 0.5 color: root.checked ? Color.mPrimary : Color.mSurface border.color: Color.mOutline - border.width: Math.max(1, Style.borderM * scaling) + border.width: Math.max(1, Style.borderS* scaling) Behavior on color { ColorAnimation { @@ -47,14 +47,14 @@ RowLayout { } Rectangle { - implicitWidth: (root.baseSize - 5) * scaling - implicitHeight: (root.baseSize - 5) * scaling + implicitWidth: Math.round((root.baseSize * 0.8) * scaling) + implicitHeight: Math.round((root.baseSize * 0.8) * scaling) radius: height * 0.5 color: root.checked ? Color.mOnPrimary : Color.mPrimary border.color: root.checked ? Color.mSurface : Color.mSurface border.width: Math.max(1, Style.borderM * scaling) anchors.verticalCenter: parent.verticalCenter - x: root.checked ? switcher.width - width - 2 * scaling : 2 * scaling + x: root.checked ? switcher.width - width - 3 * scaling : 3 * scaling Behavior on x { NumberAnimation {