plasmoid: Fix setting initial size

Some change in Qt or Plasma prevents the old way of setting
it to work (using onVisibleChanged). Using a Loader and
onLoaded seems to work better.
This commit is contained in:
Martchus 2019-02-12 00:23:51 +01:00
parent 326f03b604
commit e475454c2d
2 changed files with 4 additions and 10 deletions

View File

@ -16,7 +16,7 @@ ColumnLayout {
Layout.minimumHeight: units.gridUnit * 15 Layout.minimumHeight: units.gridUnit * 15
// define function to update the size according to the settings // define function to update the size according to the settings
// when "floating" (shown as popup) // when "floating" (shown as popup) or tied to an edge
function updateSize() { function updateSize() {
switch (plasmoid.location) { switch (plasmoid.location) {
case PlasmaCore.Types.Floating: case PlasmaCore.Types.Floating:
@ -33,13 +33,6 @@ ColumnLayout {
} }
} }
// update the size when becoming visible
onVisibleChanged: {
if (visible) {
updateSize()
}
}
// update the size when settings changed // update the size when settings changed
Connections { Connections {
target: plasmoid.nativeInterface target: plasmoid.nativeInterface

View File

@ -11,8 +11,9 @@ Item {
Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation Plasmoid.preferredRepresentation: Plasmoid.fullRepresentation
Plasmoid.compactRepresentation: CompactRepresentation { Plasmoid.compactRepresentation: CompactRepresentation {
} }
Plasmoid.fullRepresentation: FullRepresentation { Plasmoid.fullRepresentation: Loader {
focus: true source: "FullRepresentation.qml"
onLoaded: item.updateSize()
} }
Plasmoid.icon: "syncthingtray" Plasmoid.icon: "syncthingtray"