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.
master
Vlad Zahorodnii 3 years ago
parent 4881dd63a7
commit d92bbdb2be

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

Loading…
Cancel
Save