From a68b3f49b0e2997b0316d7ba46e748d41412ad85 Mon Sep 17 00:00:00 2001 From: LemmyCook Date: Sun, 7 Sep 2025 21:13:45 -0400 Subject: [PATCH] NComboBox: better sizing --- Widgets/NComboBox.qml | 15 ++++++++++----- Widgets/NPill.qml | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Widgets/NComboBox.qml b/Widgets/NComboBox.qml index 813eee5..57bc0bb 100644 --- a/Widgets/NComboBox.qml +++ b/Widgets/NComboBox.qml @@ -8,8 +8,7 @@ import qs.Widgets RowLayout { id: root - readonly property real preferredHeight: Style.baseWidgetSize * 1.1 * scaling - property real preferredWidth: 320 * scaling + property real minimumWidth: 280 * scaling property real popupHeight: 180 * scaling property string label: "" @@ -20,9 +19,11 @@ RowLayout { property string currentKey: "" property string placeholder: "" + readonly property real preferredHeight: Style.baseWidgetSize * 1.1 * scaling + signal selected(string key) - spacing: Style.marginS * scaling + spacing: Style.marginL * scaling Layout.fillWidth: true function findIndexByKey(key) { @@ -39,11 +40,15 @@ RowLayout { description: root.description } + Item { + Layout.fillWidth: true + } + ComboBox { id: combo - Layout.preferredWidth: root.preferredWidth - Layout.preferredHeight: height + Layout.minimumWidth: root.minimumWidth + Layout.preferredHeight: root.preferredHeight model: model currentIndex: findIndexByKey(currentKey) onActivated: { diff --git a/Widgets/NPill.qml b/Widgets/NPill.qml index f177864..8a1dd63 100644 --- a/Widgets/NPill.qml +++ b/Widgets/NPill.qml @@ -71,7 +71,7 @@ Item { anchors.left: rightOpen ? parent.left : undefined anchors.right: rightOpen ? undefined : parent.right anchors.leftMargin: rightOpen ? iconSize * 0.8 : 0 - anchors.rightMargin: rightOpen ? 0 : iconSize * 0.8 + anchors.rightMargin: rightOpen ? 0 : iconSize * 0.8 text: root.text font.pointSize: Style.fontSizeXS * scaling font.weight: Style.fontWeightBold