ScalingService: 1st pass of the refactoring via signals instead of nested bindings for better efficienty and compatibility with old versions of Qt

This commit is contained in:
LemmyCook 2025-09-01 13:52:12 -04:00
parent 934c8c61b3
commit 210bbac583
31 changed files with 186 additions and 56 deletions

View file

@ -11,7 +11,16 @@ Loader {
asynchronous: true
property ShellScreen screen
readonly property real scaling: screen ? ScalingService.scale(screen) : 1.0
property real scaling: ScalingService.getScreenScale(screen)
Connections {
target: ScalingService
function onScaleChanged(screenName, scale) {
if ((screen !== null) && (screenName === screen.name)) {
scaling = scale
}
}
}
property Component panelContent: null
property int panelWidth: 1500

View file

@ -10,6 +10,15 @@ Item {
property var widgetProps: ({})
property bool enabled: true
Connections {
target: ScalingService
function onScaleChanged(screenName, scale) {
if ((loader.item.screen !== null) && (screenName === loader.item.screen.name)) {
loader.item['scaling'] = scale
}
}
}
// Don't reserve space unless the loaded widget is really visible
implicitWidth: loader.item ? loader.item.visible ? loader.item.implicitWidth : 0 : 0
implicitHeight: loader.item ? loader.item.visible ? loader.item.implicitHeight : 0 : 0