mirror of
https://github.com/zoriya/noctalia-shell.git
synced 2026-08-15 18:43:59 +00:00
ControlCenter: fix scaling (pass scaling to everything)
This commit is contained in:
@@ -11,6 +11,8 @@ import qs.Widgets
|
||||
NBox {
|
||||
id: root
|
||||
|
||||
property real scaling: 1.0
|
||||
|
||||
// Background artwork that covers everything
|
||||
Item {
|
||||
anchors.fill: parent
|
||||
|
||||
@@ -10,6 +10,7 @@ import qs.Widgets
|
||||
// Power Profiles: performance, balanced, eco
|
||||
NBox {
|
||||
|
||||
property real scaling: 1.0
|
||||
property real spacing: 0
|
||||
|
||||
// Centralized service
|
||||
|
||||
@@ -14,6 +14,7 @@ import qs.Widgets
|
||||
NBox {
|
||||
id: root
|
||||
|
||||
property real scaling: 1.0
|
||||
property string uptimeText: "--"
|
||||
|
||||
RowLayout {
|
||||
|
||||
@@ -10,6 +10,7 @@ import qs.Widgets
|
||||
// Utilities: record & wallpaper
|
||||
NBox {
|
||||
|
||||
property real scaling: 1.0
|
||||
property real spacing: 0
|
||||
|
||||
RowLayout {
|
||||
|
||||
@@ -9,6 +9,7 @@ import qs.Widgets
|
||||
NBox {
|
||||
id: root
|
||||
|
||||
property real scaling: 1.0
|
||||
readonly property bool weatherReady: (LocationService.data.weather !== null)
|
||||
|
||||
ColumnLayout {
|
||||
|
||||
@@ -40,11 +40,13 @@ NPanel {
|
||||
ProfileCard {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: Math.max(64 * scaling)
|
||||
scaling: root.scaling
|
||||
}
|
||||
|
||||
WeatherCard {
|
||||
Layout.fillWidth: true
|
||||
Layout.preferredHeight: Math.max(190 * scaling)
|
||||
scaling: root.scaling
|
||||
}
|
||||
|
||||
// Middle section: media + stats column
|
||||
@@ -57,6 +59,7 @@ NPanel {
|
||||
MediaCard {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
scaling: root.scaling
|
||||
}
|
||||
|
||||
// System monitors combined in one card
|
||||
@@ -85,6 +88,7 @@ NPanel {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: content.cardSpacing
|
||||
scaling: root.scaling
|
||||
}
|
||||
|
||||
// Utilities buttons
|
||||
@@ -92,6 +96,7 @@ NPanel {
|
||||
Layout.fillWidth: true
|
||||
Layout.fillHeight: true
|
||||
spacing: content.cardSpacing
|
||||
scaling: root.scaling
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,13 @@ Rectangle {
|
||||
|
||||
// Repaint gauge when the bound value changes
|
||||
onValueChanged: gauge.requestPaint()
|
||||
|
||||
// Force repaint when scaling changes
|
||||
onScalingChanged: {
|
||||
Qt.callLater(() => {
|
||||
gauge.requestPaint()
|
||||
})
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: mainLayout
|
||||
@@ -46,7 +53,7 @@ Rectangle {
|
||||
Canvas {
|
||||
id: gauge
|
||||
anchors.fill: parent
|
||||
renderStrategy: Canvas.Cooperative
|
||||
renderStrategy: Canvas.Immediate
|
||||
|
||||
onPaint: {
|
||||
const ctx = getContext("2d")
|
||||
|
||||
@@ -146,6 +146,12 @@ Loader {
|
||||
Logger.log("NPanel", "Opened", root.objectName, "on", screen.name)
|
||||
dimmingOpacity = Style.opacityHeavy
|
||||
root.scaling = scaling = ScalingService.getScreenScale(screen)
|
||||
|
||||
// Force refresh panel content when scaling is applied
|
||||
Qt.callLater(() => {
|
||||
panelContentLoader.active = false
|
||||
panelContentLoader.active = true
|
||||
})
|
||||
}
|
||||
|
||||
Connections {
|
||||
@@ -153,6 +159,12 @@ Loader {
|
||||
function onScaleChanged(screenName, scale) {
|
||||
if ((screen !== null) && (screenName === screen.name)) {
|
||||
root.scaling = scaling = scale
|
||||
|
||||
// Force refresh panel content when scaling changes
|
||||
Qt.callLater(() => {
|
||||
panelContentLoader.active = false
|
||||
panelContentLoader.active = true
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user