From e475454c2d29f3990bdb72a02db78e3cb69faf3c Mon Sep 17 00:00:00 2001 From: Martchus Date: Tue, 12 Feb 2019 00:23:51 +0100 Subject: [PATCH] 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. --- plasmoid/package/contents/ui/FullRepresentation.qml | 9 +-------- plasmoid/package/contents/ui/main.qml | 5 +++-- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/plasmoid/package/contents/ui/FullRepresentation.qml b/plasmoid/package/contents/ui/FullRepresentation.qml index 1b82e14..380cef9 100644 --- a/plasmoid/package/contents/ui/FullRepresentation.qml +++ b/plasmoid/package/contents/ui/FullRepresentation.qml @@ -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 diff --git a/plasmoid/package/contents/ui/main.qml b/plasmoid/package/contents/ui/main.qml index cd66c5c..92de3f3 100644 --- a/plasmoid/package/contents/ui/main.qml +++ b/plasmoid/package/contents/ui/main.qml @@ -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"