[PlasmaComponents3] Strip mnemonic ampersands from tooltip text

They're never useful in that context, and this prevents having to strip
them out manually when assigning a tooltip text that comes from a source
that sets a mnemonic ampersand. For example
https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/171#note_79871
This commit is contained in:
Nate Graham 2020-07-25 21:43:12 -06:00
parent 3e225d8664
commit 0fe4fc53ef

View File

@ -45,7 +45,9 @@ T.ToolTip {
closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent
contentItem: Label {
text: control.text
// Strip out ampersands right before non-whitespace characters, i.e.
// those used to determine the alt key shortcut
text: control.text.replace(/&(?=\S)/g, "")
font: control.font
color: PlasmaCore.ColorScope.textColor
}