From 8450adfda8b2c7384a2666cf445c760d81e3f28d Mon Sep 17 00:00:00 2001 From: Lemmy Date: Mon, 9 Mar 2026 22:22:25 -0400 Subject: [PATCH] fix(widgets): add Layout.margins to bordered widgets to prevent border clipping --- Widgets/NCheckbox.qml | 1 + Widgets/NColorPicker.qml | 1 + Widgets/NComboBox.qml | 1 + Widgets/NDateTimeTokens.qml | 1 + Widgets/NSearchableComboBox.qml | 1 + Widgets/NSpinBox.qml | 1 + Widgets/NTabBar.qml | 1 + Widgets/NTextInput.qml | 2 +- Widgets/NToggle.qml | 1 + 9 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Widgets/NCheckbox.qml b/Widgets/NCheckbox.qml index 68740799a..09ed49f7f 100644 --- a/Widgets/NCheckbox.qml +++ b/Widgets/NCheckbox.qml @@ -36,6 +36,7 @@ RowLayout { Rectangle { id: box + Layout.margins: Style.borderS implicitWidth: Math.round(root.baseSize) implicitHeight: Math.round(root.baseSize) radius: Style.iRadiusXS diff --git a/Widgets/NColorPicker.qml b/Widgets/NColorPicker.qml index 3118eae70..c005240f6 100644 --- a/Widgets/NColorPicker.qml +++ b/Widgets/NColorPicker.qml @@ -12,6 +12,7 @@ Rectangle { signal colorSelected(color color) + Layout.margins: Style.borderS implicitWidth: 150 implicitHeight: Math.round(Style.baseWidgetSize * 1.1) diff --git a/Widgets/NComboBox.qml b/Widgets/NComboBox.qml index 3a2116336..c94f317e1 100644 --- a/Widgets/NComboBox.qml +++ b/Widgets/NComboBox.qml @@ -136,6 +136,7 @@ RowLayout { ComboBox { id: combo + Layout.margins: Style.borderS Layout.minimumWidth: Math.round(root.minimumWidth * Style.uiScaleRatio) Layout.preferredHeight: Math.round(root.preferredHeight * Style.uiScaleRatio) implicitWidth: Layout.minimumWidth diff --git a/Widgets/NDateTimeTokens.qml b/Widgets/NDateTimeTokens.qml index 5a7f6742e..496c70bc8 100644 --- a/Widgets/NDateTimeTokens.qml +++ b/Widgets/NDateTimeTokens.qml @@ -10,6 +10,7 @@ Rectangle { signal tokenClicked(string token) + Layout.margins: Style.borderS color: Color.mSurface border.color: Color.mOutline border.width: Style.borderS diff --git a/Widgets/NSearchableComboBox.qml b/Widgets/NSearchableComboBox.qml index fabda7c7c..6ad6fd1f4 100644 --- a/Widgets/NSearchableComboBox.qml +++ b/Widgets/NSearchableComboBox.qml @@ -168,6 +168,7 @@ RowLayout { ComboBox { id: combo + Layout.margins: Style.borderS Layout.minimumWidth: Math.round(root.minimumWidth * Style.uiScaleRatio) Layout.preferredHeight: Math.round(root.preferredHeight * Style.uiScaleRatio) implicitWidth: Layout.minimumWidth diff --git a/Widgets/NSpinBox.qml b/Widgets/NSpinBox.qml index 1ef3850a0..36130fa18 100644 --- a/Widgets/NSpinBox.qml +++ b/Widgets/NSpinBox.qml @@ -91,6 +91,7 @@ RowLayout { // Main spinbox container Rectangle { id: spinBoxContainer + Layout.margins: Style.borderS implicitWidth: 120 implicitHeight: Math.round((root.baseSize - 4) / 2) * 2 radius: Style.iRadiusS diff --git a/Widgets/NTabBar.qml b/Widgets/NTabBar.qml index 89921b606..e689c212e 100644 --- a/Widgets/NTabBar.qml +++ b/Widgets/NTabBar.qml @@ -66,6 +66,7 @@ Rectangle { } // Styling + Layout.margins: Style.borderS implicitWidth: tabRow.implicitWidth + (margins * 2) implicitHeight: tabHeight + (margins * 2) color: Color.mSurfaceVariant diff --git a/Widgets/NTextInput.qml b/Widgets/NTextInput.qml index 51e12a71e..66fef69a0 100644 --- a/Widgets/NTextInput.qml +++ b/Widgets/NTextInput.qml @@ -56,7 +56,7 @@ ColumnLayout { Layout.fillWidth: true Layout.minimumWidth: root.minimumInputWidth - Layout.margins: Math.ceil(Style.borderS) + Layout.margins: Style.borderS implicitHeight: Style.baseWidgetSize * 1.1 * Style.uiScaleRatio // This is important - makes the control accept focus diff --git a/Widgets/NToggle.qml b/Widgets/NToggle.qml index 1770d4908..744e69a15 100644 --- a/Widgets/NToggle.qml +++ b/Widgets/NToggle.qml @@ -45,6 +45,7 @@ RowLayout { id: switcher Layout.alignment: Qt.AlignVCenter + Layout.margins: Style.borderS implicitWidth: Math.round(root.baseSize * .85) * 2 implicitHeight: Math.round(root.baseSize * .5) * 2