mirror of
https://invent.kde.org/marcoa/shift-shell.git
synced 2026-04-27 14:33:08 +00:00
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
This commit is contained in:
parent
38f15ced14
commit
4cd1dfaf04
1 changed files with 16 additions and 7 deletions
|
|
@ -41,7 +41,6 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
onFullRepresentationChanged: {
|
onFullRepresentationChanged: {
|
||||||
|
|
||||||
if (!fullRepresentation) {
|
if (!fullRepresentation) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -49,6 +48,18 @@ Item {
|
||||||
fullRepresentation.parent = appletParent;
|
fullRepresentation.parent = appletParent;
|
||||||
fullRepresentation.anchors.fill = fullRepresentation.parent;
|
fullRepresentation.anchors.fill = fullRepresentation.parent;
|
||||||
fullRepresentation.anchors.margins = appletParent.margins.top;
|
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 {
|
FocusScope {
|
||||||
|
|
@ -95,18 +106,16 @@ Item {
|
||||||
Connections {
|
Connections {
|
||||||
target: plasmoidItem
|
target: plasmoidItem
|
||||||
function onExpandedChanged() {
|
function onExpandedChanged() {
|
||||||
if (plasmoidItem.expanded) {
|
// When plasmoidItem is expanded, it can be possible fullRepresentation is null
|
||||||
expandedOverlay.showFullScreen()
|
// so we not need to display expandedOverlay now to avoid display empty expandedOverlay
|
||||||
} else {
|
updateExpandedOverlay();
|
||||||
expandedOverlay.visible = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NanoShell.FullScreenOverlay {
|
NanoShell.FullScreenOverlay {
|
||||||
id: expandedOverlay
|
id: expandedOverlay
|
||||||
color: Qt.rgba(0, 0, 0, 0.6)
|
color: Qt.rgba(0, 0, 0, 0.6)
|
||||||
visible: plasmoidItem && plasmoidItem.expanded
|
visible: plasmoidItem?.expanded && fullRepresentation
|
||||||
width: Screen.width
|
width: Screen.width
|
||||||
height: Screen.height
|
height: Screen.height
|
||||||
MouseArea {
|
MouseArea {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue