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
// 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() {
switch (plasmoid.location) {
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
Connections {
target: plasmoid.nativeInterface

View File

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