Load close button in WindowHeapDelegate on demand

Most windows are typically not hovered, so we don't need to create
a Button for every one of them.
wilder/Plasma/6.2
Vlad Zahorodnii 2 years ago
parent 71dd6bac78
commit 8e2d0a3d7e
  1. 25
      src/plugins/private/qml/WindowHeapDelegate.qml

@ -431,28 +431,29 @@ Item {
}
}
PC3.Button {
Loader {
id: closeButton
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
anchors {
right: thumbSource.right
top: thumbSource.top
margins: Kirigami.Units.smallSpacing
}
active: thumb.closeButtonVisible && (hoverHandler.hovered || Kirigami.Settings.tabletMode || Kirigami.Settings.hasTransientTouchInput) && thumb.window.closeable && !thumb.activeDragHandler.active
visible: thumb.closeButtonVisible && (hoverHandler.hovered || Kirigami.Settings.tabletMode || Kirigami.Settings.hasTransientTouchInput) && thumb.window.closeable && !thumb.activeDragHandler.active
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
text: i18ndc("kwin", "@info:tooltip as in: 'close this window'", "Close window")
icon.name: "window-close"
display: PC3.AbstractButton.IconOnly
sourceComponent: PC3.Button {
text: i18ndc("kwin", "@info:tooltip as in: 'close this window'", "Close window")
icon.name: "window-close"
display: PC3.AbstractButton.IconOnly
PC3.ToolTip.text: text
PC3.ToolTip.visible: hovered && display === PC3.AbstractButton.IconOnly
PC3.ToolTip.delay: Kirigami.Units.toolTipDelay
Accessible.name: text
PC3.ToolTip.text: text
PC3.ToolTip.visible: hovered && display === PC3.AbstractButton.IconOnly
PC3.ToolTip.delay: Kirigami.Units.toolTipDelay
Accessible.name: text
onClicked: thumb.window.closeWindow();
onClicked: thumb.window.closeWindow();
}
}
Component.onDestruction: {

Loading…
Cancel
Save