Commit f53bb840 authored by Nate Graham's avatar Nate Graham
Browse files

effects/overview: clean up code for buttons with tooltips

parent abbbc0b7
Pipeline #200181 canceled with stage
......@@ -182,12 +182,16 @@ Item {
anchors.right: parent.right
anchors.top: parent.top
sourceComponent: PC3.Button {
text: i18nd("kwin_effects", "Delete virtual desktop")
icon.name: "delete"
onClicked: delegate.remove()
PC3.ToolTip {
text: i18nd("kwin_effects", "Delete virtual desktop")
}
display: PC3.AbstractButton.IconOnly
PC3.ToolTip.text: text
PC3.ToolTip.visible: hovered
PC3. ToolTip.delay: Kirigami.Units.toolTipDelay
Accessible.name: text
onClicked: delegate.remove()
}
}
......@@ -269,15 +273,24 @@ Item {
PC3.Button {
width: bar.desktopWidth
height: bar.desktopHeight
text: i18nd("kwin_effects", "Add Desktop")
icon.name: "list-add"
display: PC3.AbstractButton.IconOnly
opacity: hovered ? 1 : 0.75
action: Action {
onTriggered: desktopModel.create(desktopModel.rowCount())
}
ToolTip.text: i18nd("kwin_effects", "Add Desktop")
ToolTip.visible: hovered
ToolTip.delay: Kirigami.Units.toolTipDelay
PC3.ToolTip.text: text
PC3.ToolTip.visible: hovered
PC3. ToolTip.delay: Kirigami.Units.toolTipDelay
Accessible.name: text
Keys.onReturnPressed: action.trigger()
Keys.onEnterPressed: action.trigger()
Keys.onLeftPressed: nextItemInFocusChain(LayoutMirroring.enabled).forceActiveFocus(Qt.BacktabFocusReason);
Keys.onRightPressed: nextItemInFocusChain(!LayoutMirroring.enabled).forceActiveFocus(Qt.TabFocusReason);
onClicked: desktopModel.create(desktopModel.rowCount())
DropArea {
anchors.fill: parent
......@@ -289,12 +302,6 @@ Item {
drag.source.desktop = desktopModel.rowCount() + 1;
}
}
Keys.onReturnPressed: action.trigger()
Keys.onEnterPressed: action.trigger()
Keys.onLeftPressed: nextItemInFocusChain(LayoutMirroring.enabled).forceActiveFocus(Qt.BacktabFocusReason);
Keys.onRightPressed: nextItemInFocusChain(!LayoutMirroring.enabled).forceActiveFocus(Qt.TabFocusReason);
}
}
}
......
......@@ -358,26 +358,26 @@ Item {
PC3.Button {
id: closeButton
visible: thumb.closeButtonVisible && (hoverHandler.hovered || Kirigami.Settings.tabletMode || Kirigami.Settings.hasTransientTouchInput) && thumb.client.closeable && !dragHandler.active
anchors {
right: thumbSource.right
rightMargin: PlasmaCore.Units.smallSpacing
top: thumbSource.top
topMargin: PlasmaCore.Units.smallSpacing
margins: PlasmaCore.Units.smallSpacing
}
visible: thumb.closeButtonVisible && (hoverHandler.hovered || Kirigami.Settings.tabletMode || Kirigami.Settings.hasTransientTouchInput) && thumb.client.closeable && !dragHandler.active
LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft
text: i18ndc("kwin_effects", "@info:tooltip as in: 'close this window'", "Close window")
icon.name: "window-close"
implicitWidth: PlasmaCore.Units.iconSizes.medium
implicitHeight: implicitWidth
onClicked: thumb.client.closeWindow();
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
onClicked: thumb.client.closeWindow();
}
Component.onDestruction: {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment