effects/overview: Load close button in WindowHeap on demand

For many windows it will be invisible, so there's little point for
creating it ahead of time. Another reason for loading the close button
on demand is that Plasma components are typically heavy.
This commit is contained in:
Vlad Zahorodnii 2021-11-24 14:24:17 +02:00
parent 4881dd63a7
commit d92bbdb2be

View file

@ -229,17 +229,19 @@ FocusScope {
}
}
PC3.Button {
Loader {
LayoutMirroring.enabled: Qt.application.layoutDirection == Qt.RightToLeft
icon.name: "window-close"
active: (hoverHandler.hovered || Kirigami.Settings.tabletMode || Kirigami.Settings.hasTransientTouchInput) && thumb.client.closeable && !dragHandler.active
anchors.right: thumbSource.right
anchors.rightMargin: PlasmaCore.Units.largeSpacing
anchors.top: thumbSource.top
anchors.topMargin: PlasmaCore.Units.largeSpacing
implicitWidth: PlasmaCore.Units.iconSizes.medium
implicitHeight: implicitWidth
visible: (hovered || hoverHandler.hovered || Kirigami.Settings.tabletMode || Kirigami.Settings.hasTransientTouchInput) && thumb.client.closeable && !dragHandler.active
onClicked: thumb.client.closeWindow();
sourceComponent: PC3.Button {
icon.name: "window-close"
implicitWidth: PlasmaCore.Units.iconSizes.medium
implicitHeight: implicitWidth
onClicked: thumb.client.closeWindow();
}
}
Component.onDestruction: {