From 4cd1dfaf049893dc01a485f13fe979f2e9c2cd5d Mon Sep 17 00:00:00 2001 From: Florian RICHER Date: Sat, 28 Jun 2025 04:35:12 +0200 Subject: [PATCH] shell: Fix Compact applet display popup when fullRepresentation is null Fix https://invent.kde.org/plasma/plasma-mobile/-/issues/361 Avoid to display empty popup when fullRepresentation is set to null --- shell/contents/applet/CompactApplet.qml | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/shell/contents/applet/CompactApplet.qml b/shell/contents/applet/CompactApplet.qml index 7b1146d6..3a00d237 100644 --- a/shell/contents/applet/CompactApplet.qml +++ b/shell/contents/applet/CompactApplet.qml @@ -41,7 +41,6 @@ Item { } onFullRepresentationChanged: { - if (!fullRepresentation) { return; } @@ -49,6 +48,18 @@ Item { fullRepresentation.parent = appletParent; fullRepresentation.anchors.fill = fullRepresentation.parent; fullRepresentation.anchors.margins = appletParent.margins.top; + fullRepresentation.visible = true; + + // If plasmoidItem is expanded, we need to update expanded overlay to display it + updateExpandedOverlay(); + } + + function updateExpandedOverlay(): void { + if (plasmoidItem?.expanded && fullRepresentation) { + expandedOverlay.showFullScreen() + } else { + expandedOverlay.visible = false; + } } FocusScope { @@ -95,18 +106,16 @@ Item { Connections { target: plasmoidItem function onExpandedChanged() { - if (plasmoidItem.expanded) { - expandedOverlay.showFullScreen() - } else { - expandedOverlay.visible = false; - } + // When plasmoidItem is expanded, it can be possible fullRepresentation is null + // so we not need to display expandedOverlay now to avoid display empty expandedOverlay + updateExpandedOverlay(); } } NanoShell.FullScreenOverlay { id: expandedOverlay color: Qt.rgba(0, 0, 0, 0.6) - visible: plasmoidItem && plasmoidItem.expanded + visible: plasmoidItem?.expanded && fullRepresentation width: Screen.width height: Screen.height MouseArea {