Fix some scaling issues

This commit is contained in:
Ly-sec 2025-08-25 06:48:46 +02:00
parent ee13e5eaa8
commit 9e41697001
3 changed files with 31 additions and 5 deletions

View file

@ -7,7 +7,7 @@ import qs.Services
import qs.Widgets import qs.Widgets
Item { Item {
property real scaling: 1 readonly property real scaling: ScalingService.scale(screen)
readonly property string tabIcon: "brightness_6" readonly property string tabIcon: "brightness_6"
readonly property string tabLabel: "Brightness" readonly property string tabLabel: "Brightness"
Layout.fillWidth: true Layout.fillWidth: true

View file

@ -27,7 +27,7 @@ Item {
}) })
} }
ScrollView { ScrollView {
anchors.fill: parent anchors.fill: parent
clip: true clip: true
ScrollBar.vertical.policy: ScrollBar.AsNeeded ScrollBar.vertical.policy: ScrollBar.AsNeeded
@ -35,7 +35,9 @@ Item {
contentWidth: parent.width contentWidth: parent.width
ColumnLayout { ColumnLayout {
width: parent.width id: contentColumn
width: Math.max(parent.width, 300) // Minimum reasonable width without scaling
ColumnLayout { ColumnLayout {
spacing: Style.marginL * scaling spacing: Style.marginL * scaling
Layout.margins: Style.marginL * scaling Layout.margins: Style.marginL * scaling
@ -58,6 +60,8 @@ Item {
model: Quickshell.screens || [] model: Quickshell.screens || []
delegate: Rectangle { delegate: Rectangle {
Layout.fillWidth: true Layout.fillWidth: true
// Remove the scaling-based minimum width that causes issues at low scaling
// Layout.minimumWidth: 400 * scaling
radius: Style.radiusM * scaling radius: Style.radiusM * scaling
color: Color.mSurface color: Color.mSurface
border.color: Color.mOutline border.color: Color.mOutline
@ -69,6 +73,7 @@ Item {
anchors.fill: parent anchors.fill: parent
anchors.margins: Style.marginL * scaling anchors.margins: Style.marginL * scaling
spacing: Style.marginXXS * scaling spacing: Style.marginXXS * scaling
Layout.minimumWidth: 0
NText { NText {
text: (modelData.name || "Unknown") text: (modelData.name || "Unknown")
@ -85,8 +90,12 @@ Item {
ColumnLayout { ColumnLayout {
spacing: Style.marginL * scaling spacing: Style.marginL * scaling
Layout.minimumWidth: 0
Layout.fillWidth: true
NToggle { NToggle {
Layout.fillWidth: true
Layout.minimumWidth: 0
label: "Bar" label: "Bar"
description: "Enable the bar on this monitor." description: "Enable the bar on this monitor."
checked: (Settings.data.bar.monitors || []).indexOf(modelData.name) !== -1 checked: (Settings.data.bar.monitors || []).indexOf(modelData.name) !== -1
@ -100,6 +109,8 @@ Item {
} }
NToggle { NToggle {
Layout.fillWidth: true
Layout.minimumWidth: 0
label: "Notifications" label: "Notifications"
description: "Enable notifications on this monitor." description: "Enable notifications on this monitor."
checked: (Settings.data.notifications.monitors || []).indexOf(modelData.name) !== -1 checked: (Settings.data.notifications.monitors || []).indexOf(modelData.name) !== -1
@ -115,6 +126,8 @@ Item {
} }
NToggle { NToggle {
Layout.fillWidth: true
Layout.minimumWidth: 0
label: "Dock" label: "Dock"
description: "Enable the dock on this monitor." description: "Enable the dock on this monitor."
checked: (Settings.data.dock.monitors || []).indexOf(modelData.name) !== -1 checked: (Settings.data.dock.monitors || []).indexOf(modelData.name) !== -1
@ -130,11 +143,16 @@ Item {
ColumnLayout { ColumnLayout {
spacing: Style.marginL * scaling spacing: Style.marginL * scaling
Layout.fillWidth: true
RowLayout { RowLayout {
Layout.fillWidth: true
ColumnLayout { ColumnLayout {
spacing: Style.marginXXS * scaling spacing: Style.marginXXS * scaling
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: 0
NText { NText {
text: "Scale" text: "Scale"
font.pointSize: Style.fontSizeM * scaling font.pointSize: Style.fontSizeM * scaling
@ -149,14 +167,19 @@ Item {
Layout.fillWidth: true Layout.fillWidth: true
} }
} }
NText { NText {
text: `${Math.round(ScalingService.scaleByName(modelData.name) * 100)}%` text: `${Math.round(ScalingService.scaleByName(modelData.name) * 100)}%`
Layout.alignment: Qt.AlignVCenter Layout.alignment: Qt.AlignVCenter
Layout.minimumWidth: implicitWidth
} }
} }
RowLayout { RowLayout {
spacing: Style.marginS * scaling spacing: Style.marginS * scaling
Layout.fillWidth: true
Layout.minimumWidth: 0
NSlider { NSlider {
id: scaleSlider id: scaleSlider
from: 0.6 from: 0.6
@ -169,12 +192,15 @@ Item {
Settings.data.monitorsScaling = data Settings.data.monitorsScaling = data
} }
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: 50 // Ensure minimum slider width
} }
NIconButton { NIconButton {
icon: "refresh" icon: "refresh"
tooltipText: "Reset Scaling" tooltipText: "Reset Scaling"
fontPointSize: Style.fontSizeL * scaling fontPointSize: Style.fontSizeL * scaling
Layout.preferredWidth: implicitWidth
Layout.minimumWidth: implicitWidth
onClicked: { onClicked: {
var data = Settings.data.monitorsScaling || {} var data = Settings.data.monitorsScaling || {}
data[modelData.name] = 1.0 data[modelData.name] = 1.0
@ -193,4 +219,4 @@ Item {
} }
} }
} }
} }

View file

@ -7,7 +7,7 @@ import qs.Services
import qs.Widgets import qs.Widgets
Item { Item {
property real scaling: 1 readonly property real scaling: ScalingService.scale(screen)
readonly property string tabIcon: "photo_library" readonly property string tabIcon: "photo_library"
readonly property string tabLabel: "Wallpaper Selector" readonly property string tabLabel: "Wallpaper Selector"
readonly property int tabIndex: 7 readonly property int tabIndex: 7