NComboBox: better sizing

This commit is contained in:
LemmyCook 2025-09-07 21:13:45 -04:00
parent e03042c411
commit a68b3f49b0
2 changed files with 11 additions and 6 deletions

View file

@ -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: {

View file

@ -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