Fix toggle placement in user settings

This commit is contained in:
Nicolas Werner 2023-06-09 19:38:58 +02:00
parent 2eccec6636
commit 805f0a3032
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9

View file

@ -33,15 +33,17 @@ Rectangle {
spacing: Nheko.paddingMedium spacing: Nheko.paddingMedium
width: scroll.availableWidth
anchors.fill: parent anchors.fill: parent
anchors.leftMargin: userSettingsDialog.collapsed ? 0 : (userSettingsDialog.width-userSettingsDialog.collapsePoint) * 0.4 + Nheko.paddingLarge anchors.leftMargin: userSettingsDialog.collapsed ? 0 : (userSettingsDialog.width-userSettingsDialog.collapsePoint) * 0.4 + Nheko.paddingLarge
anchors.rightMargin: anchors.leftMargin anchors.rightMargin: anchors.leftMargin
Repeater { Repeater {
model: UserSettingsModel model: UserSettingsModel
Layout.fillWidth:true
delegate: GridLayout { delegate: GridLayout {
width: scroll.availableWidth
columns: collapsed? 1 : 2 columns: collapsed? 1 : 2
rows: collapsed? 2: 1 rows: collapsed? 2: 1
required property var model required property var model
@ -78,7 +80,7 @@ Rectangle {
Layout.columnSpan: (model.type == UserSettingsModel.SectionTitle && !userSettingsDialog.collapsed) ? 2 : 1 Layout.columnSpan: (model.type == UserSettingsModel.SectionTitle && !userSettingsDialog.collapsed) ? 2 : 1
Layout.preferredHeight: child.height Layout.preferredHeight: child.height
Layout.preferredWidth: Math.min(child.implicitWidth, child.width || 1000) Layout.preferredWidth: child.implicitWidth
Layout.maximumWidth: model.type == UserSettingsModel.SectionTitle ? Number.POSITIVE_INFINITY : 400 Layout.maximumWidth: model.type == UserSettingsModel.SectionTitle ? Number.POSITIVE_INFINITY : 400
Layout.fillWidth: model.type == UserSettingsModel.SectionTitle || model.type == UserSettingsModel.Options || model.type == UserSettingsModel.Number Layout.fillWidth: model.type == UserSettingsModel.SectionTitle || model.type == UserSettingsModel.Options || model.type == UserSettingsModel.Number
Layout.rightMargin: model.type == UserSettingsModel.SectionTitle ? 0 : Nheko.paddingMedium Layout.rightMargin: model.type == UserSettingsModel.SectionTitle ? 0 : Nheko.paddingMedium
@ -95,9 +97,9 @@ Rectangle {
roleValue: UserSettingsModel.Options roleValue: UserSettingsModel.Options
ComboBox { ComboBox {
anchors.right: parent.right anchors.right: parent.right
width: Math.min(parent.width, implicitWidth)
model: r.model.values model: r.model.values
currentIndex: r.model.value currentIndex: r.model.value
width: Math.min(implicitWidth, scroll.availableWidth - Nheko.paddingMedium)
onCurrentIndexChanged: r.model.value = currentIndex onCurrentIndexChanged: r.model.value = currentIndex
implicitContentWidthPolicy: ComboBox.WidestTextWhenCompleted implicitContentWidthPolicy: ComboBox.WidestTextWhenCompleted
@ -109,7 +111,6 @@ Rectangle {
SpinBox { SpinBox {
anchors.right: parent.right anchors.right: parent.right
width: Math.min(parent.width, implicitWidth)
from: model.valueLowerBound from: model.valueLowerBound
to: model.valueUpperBound to: model.valueUpperBound
stepSize: model.valueStep stepSize: model.valueStep
@ -130,7 +131,6 @@ Rectangle {
readonly property int decimals: 2 readonly property int decimals: 2
anchors.right: parent.right anchors.right: parent.right
width: Math.min(parent.width, implicitWidth)
from: model.valueLowerBound * div from: model.valueLowerBound * div
to: model.valueUpperBound * div to: model.valueUpperBound * div
stepSize: model.valueStep * div stepSize: model.valueStep * div