Merge pull request #433 from lonerOrz/fix/brightness-layout

fix(settings): Correct brightness slider layout issues
This commit is contained in:
Lemmy
2025-10-06 18:07:51 -04:00
committed by GitHub
+28 -20
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,30 +158,34 @@ ColumnLayout {
NText {
text: I18n.tr("settings.display.monitors.brightness")
Layout.preferredWidth: 80 * scaling
Layout.alignment: Qt.AlignVCenter
}
NValueSlider {
Layout.fillWidth: true
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
}
// Empty container to match scale row layout
Item {
Layout.preferredWidth: 30 * scaling
Layout.preferredHeight: 30 * scaling
NText {
text: brightnessMonitor ? Math.round(brightnessSlider.value * 100) + "%" : "N/A"
Layout.preferredWidth: 55 * scaling
horizontalAlignment: Text.AlignRight
Layout.alignment: Qt.AlignVCenter
}
// Method text positioned in the button area
Item {
Layout.preferredWidth: 35 * scaling
Layout.fillHeight: true
NText {
text: brightnessMonitor ? brightnessMonitor.method : ""
text: brightnessMonitor ? "(" + brightnessMonitor.method + ")" : ""
pointSize: Style.fontSizeXS * scaling
color: Color.mOnSurfaceVariant
anchors.right: parent.right
anchors.verticalCenter: parent.verticalCenter
anchors.centerIn: parent
horizontalAlignment: Text.AlignRight
}
}