Stack cog options so they fit narrow lanes

Each option's label sits on its own line (with a toggle or a slider's
value and unit), and its dropdown, text field or slider spans the card
below it, instead of squeezing fixed-width controls beside the label.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
mxandClaude Opus 5.5 committed 2026-11-29 14:58:02 +01:00
1 parent 1a394955cf
commit 660fa69be6
1 file changed
+30 -22
+30 -22
View File
@@ -194,26 +194,45 @@ Item {
id:optionsColumn
visible:card.expanded
anchors {left:parent.left;right:parent.right;top:parent.top;topMargin:50;leftMargin:12;rightMargin:10}
spacing:6
spacing:10
Repeater {
model:card.schema
RowLayout {
// Label line (with a toggle or a slider's value), then the control at
// the card's full width: lanes are narrow, so nothing sits beside a field.
ColumnLayout {
id:optionRow
required property var modelData
readonly property var value:root.valueOf(card.modelData,modelData)
readonly property string kind:modelData.type
readonly property bool numeric:kind==="integer" || kind==="number"
Layout.fillWidth:true
spacing:3
RowLayout {
Layout.fillWidth:true
spacing:8
Text {text:optionRow.modelData.label;color:Theme.textSecondary;font.pixelSize:11;Layout.fillWidth:true;elide:Text.ElideRight
Text {text:optionRow.modelData.label;color:Theme.textSecondary;font.pixelSize:11;Layout.fillWidth:true;wrapMode:Text.Wrap
HoverHandler {id:labelHover}
GlassToolTip {
visible: labelHover.hovered && !!optionRow.modelData.description
delay: 600
text: optionRow.modelData.description || ""
}}
GlassToggle {
visible:optionRow.kind==="boolean"
checked:optionRow.value===true
onToggled:root.setOption(card.modelData,optionRow.modelData.key,checked)
}
Text {
visible:optionRow.numeric
text:optionRow.value===undefined ? "" : String(optionRow.value)+(optionRow.modelData.unit ? " "+optionRow.modelData.unit : "")
color:Theme.text;font.pixelSize:11
horizontalAlignment:Text.AlignRight
}
}
GlassComboBox {
objectName:"bar-option-"+card.modelData.id+"-"+optionRow.modelData.key
visible:optionRow.modelData.type==="choice"
Layout.preferredWidth:110
visible:optionRow.kind==="choice"
Layout.fillWidth:true
implicitHeight:30
model:(optionRow.modelData.choices || []).map((c,i)=>({text:optionRow.modelData.choiceLabels ? optionRow.modelData.choiceLabels[i] : String(c).charAt(0).toUpperCase()+String(c).slice(1),value:c}))
textRole:"text"
@@ -221,30 +240,19 @@ Item {
currentIndex:(optionRow.modelData.choices || []).indexOf(optionRow.value)
onActivated:root.setOption(card.modelData,optionRow.modelData.key,currentValue)
}
GlassToggle {
visible:optionRow.modelData.type==="boolean"
checked:optionRow.value===true
onToggled:root.setOption(card.modelData,optionRow.modelData.key,checked)
}
Text {
visible:optionRow.modelData.type==="integer" || optionRow.modelData.type==="number"
text:optionRow.value===undefined ? "" : String(optionRow.value)
color:Theme.text;font.pixelSize:11
Layout.preferredWidth:26;horizontalAlignment:Text.AlignRight
}
GlassSlider {
visible:optionRow.modelData.type==="integer" || optionRow.modelData.type==="number"
Layout.preferredWidth:90
visible:optionRow.numeric
Layout.fillWidth:true
implicitHeight:26
from:Number(optionRow.modelData.min !== undefined ? optionRow.modelData.min : 0)
to:Number(optionRow.modelData.max !== undefined ? optionRow.modelData.max : 100)
stepSize:Number(optionRow.modelData.step || (optionRow.modelData.type==="integer" ? 1 : 0.1))
stepSize:Number(optionRow.modelData.step || (optionRow.kind==="integer" ? 1 : 0.1))
value:Number(optionRow.value || 0)
onMoved:root.setOption(card.modelData,optionRow.modelData.key,optionRow.modelData.type==="integer" ? Math.round(value) : value)
onMoved:root.setOption(card.modelData,optionRow.modelData.key,optionRow.kind==="integer" ? Math.round(value) : value)
}
GlassTextField {
visible:optionRow.modelData.type==="string"
Layout.preferredWidth:110
visible:optionRow.kind==="string"
Layout.fillWidth:true
implicitHeight:30
text:optionRow.value===undefined ? "" : String(optionRow.value)
onEditingFinished:root.setOption(card.modelData,optionRow.modelData.key,text)