windowview: Only create PlaceholderMessage when needed

If there's windows and we're not searching, we don't need the
PlaceholderMessage. So only create it when we actually need it to reduce
the time needed to activate the effect.
This commit is contained in:
Arjen Hiemstra 2022-11-22 12:05:21 +01:00
parent 8242584b6e
commit 39a3b53bfb

View file

@ -90,11 +90,12 @@ Item {
}
}
PlasmaExtras.PlaceholderMessage {
Loader {
anchors.centerIn: parent
width: parent.width - (PlasmaCore.Units.gridUnit * 8)
visible: heap.activeEmpty
active: heap.activeEmpty
// Otherwise it's always 100% opaque even while the blurry desktop background's
// opacity is changing, which looks weird and is different from what Overview does.
opacity: container.organized ? 1 : 0
@ -102,9 +103,11 @@ Item {
OpacityAnimator { duration: container.effect.animationDuration; easing.type: Easing.OutCubic }
}
sourceComponent: PlasmaExtras.PlaceholderMessage {
iconName: "edit-none"
text: effect.searchText.length > 0 ? i18nd("kwin_effects", "No Matches") : i18nd("kwin_effects", "No Windows")
}
}
ColumnLayout {
width: targetScreen.geometry.width