fix(settings): Refactor slider layout to fix alignment and text overlap

This commit is contained in:
loner
2025-10-07 05:38:40 +08:00
parent 4402263a97
commit 63de7ccb16
+32 -19
View File
@@ -109,6 +109,7 @@ ColumnLayout {
NText {
text: I18n.tr("settings.display.monitors.scale")
Layout.preferredWidth: 80 * scaling
Layout.alignment: Qt.AlignVCenter
}
NValueSlider {
@@ -118,24 +119,27 @@ ColumnLayout {
stepSize: 0.01
value: localScaling
onPressedChanged: (pressed, value) => ScalingService.setScreenScale(modelData, value)
text: I18n.tr("system.scaling-percentage", {
"percentage": Math.round(localScaling * 100)
})
Layout.fillWidth: true
}
// Reset button container
Item {
Layout.preferredWidth: 30 * scaling
Layout.preferredHeight: 30 * scaling
NText {
text: I18n.tr("system.scaling-percentage", {
"percentage": Math.round(scaleSlider.value * 100)
})
Layout.preferredWidth: 55 * scaling
horizontalAlignment: Text.AlignRight
Layout.alignment: Qt.AlignVCenter
}
Item {
Layout.preferredWidth: 35 * scaling
Layout.fillHeight: true
NIconButton {
icon: "refresh"
baseSize: Style.baseWidgetSize * 0.9
tooltipText: I18n.tr("settings.display.monitors.reset-scaling")
onClicked: ScalingService.setScreenScale(modelData, 1.0)
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.centerIn: parent
}
}
}
@@ -143,7 +147,7 @@ ColumnLayout {
// Brightness
ColumnLayout {
spacing: Style.marginL * scaling
spacing: Style.marginS * scaling
Layout.fillWidth: true
visible: brightnessMonitor !== undefined && brightnessMonitor !== null
@@ -154,27 +158,36 @@ ColumnLayout {
NText {
text: I18n.tr("settings.display.monitors.brightness")
Layout.preferredWidth: 80 * scaling
}
Item {
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
}
NValueSlider {
id: brightnessSlider
from: 0
to: 1
value: brightnessMonitor ? brightnessMonitor.brightness : 0.5
stepSize: 0.01
onPressedChanged: (pressed, value) => brightnessMonitor.setBrightness(value)
text: brightnessMonitor ? Math.round(brightnessMonitor.brightness * 100) + "%" : "N/A"
Layout.fillWidth: true
}
NText {
text: brightnessMonitor ? "(" + brightnessMonitor.method + ")" : ""
pointSize: Style.fontSizeXS * scaling
color: Color.mOnSurfaceVariant
Layout.alignment: Qt.AlignVCenter
text: brightnessMonitor ? Math.round(brightnessSlider.value * 100) + "%" : "N/A"
Layout.preferredWidth: 55 * scaling
horizontalAlignment: Text.AlignRight
Layout.alignment: Qt.AlignVCenter
}
Item {
Layout.preferredWidth: 35 * scaling
Layout.fillHeight: true
NText {
text: brightnessMonitor ? "(" + brightnessMonitor.method + ")" : ""
pointSize: Style.fontSizeXS * scaling
color: Color.mOnSurfaceVariant
anchors.centerIn: parent
horizontalAlignment: Text.AlignRight
}
}
}
}