TrayMenu: fix dynamic scaling
This commit is contained in:
parent
210bbac583
commit
87067f7062
2 changed files with 18 additions and 7 deletions
|
|
@ -17,6 +17,15 @@ PopupWindow {
|
||||||
property ShellScreen screen
|
property ShellScreen screen
|
||||||
property real scaling: ScalingService.getScreenScale(screen)
|
property real scaling: ScalingService.getScreenScale(screen)
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
target: ScalingService
|
||||||
|
function onScaleChanged(screenName, scale) {
|
||||||
|
if ((screen != null) && (screenName === screen.name)) {
|
||||||
|
scaling = scale
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
readonly property int menuWidth: 180
|
readonly property int menuWidth: 180
|
||||||
|
|
||||||
implicitWidth: menuWidth * scaling
|
implicitWidth: menuWidth * scaling
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,14 @@ Rectangle {
|
||||||
property real scaling: 1.0
|
property real scaling: 1.0
|
||||||
readonly property real itemSize: 24 * scaling
|
readonly property real itemSize: 24 * scaling
|
||||||
|
|
||||||
|
function onLoaded() {
|
||||||
|
// When the widget is fully initialized with its props
|
||||||
|
// set the screen for the trayMenu
|
||||||
|
if (trayMenu.item) {
|
||||||
|
trayMenu.item.screen = screen
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
visible: SystemTray.items.values.length > 0
|
visible: SystemTray.items.values.length > 0
|
||||||
implicitWidth: tray.width + Style.marginM * scaling * 2
|
implicitWidth: tray.width + Style.marginM * scaling * 2
|
||||||
implicitHeight: Math.round(Style.capsuleHeight * scaling)
|
implicitHeight: Math.round(Style.capsuleHeight * scaling)
|
||||||
|
|
@ -156,12 +164,6 @@ Rectangle {
|
||||||
Loader {
|
Loader {
|
||||||
id: trayMenu
|
id: trayMenu
|
||||||
source: "../Extras/TrayMenu.qml"
|
source: "../Extras/TrayMenu.qml"
|
||||||
|
|
||||||
onLoaded: {
|
|
||||||
if (item) {
|
|
||||||
item.screen = screen
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue