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 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
|
||||
|
||||
implicitWidth: menuWidth * scaling
|
||||
|
|
|
|||
|
|
@ -17,6 +17,14 @@ Rectangle {
|
|||
property real scaling: 1.0
|
||||
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
|
||||
implicitWidth: tray.width + Style.marginM * scaling * 2
|
||||
implicitHeight: Math.round(Style.capsuleHeight * scaling)
|
||||
|
|
@ -155,13 +163,7 @@ Rectangle {
|
|||
|
||||
Loader {
|
||||
id: trayMenu
|
||||
source: "../Extras/TrayMenu.qml"
|
||||
|
||||
onLoaded: {
|
||||
if (item) {
|
||||
item.screen = screen
|
||||
}
|
||||
}
|
||||
source: "../Extras/TrayMenu.qml"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue