[components] Hook up Mnemonics
Currently in buttons and tabs the mnemonics were shown, but never actually attached to do anything. This copies code from QQC2-desktop-style and creates an explicit shortcut.
This commit is contained in:
parent
c1560df1cc
commit
2c07c2a455
@ -32,6 +32,13 @@ T.Button {
|
||||
Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.SecondaryControl
|
||||
Kirigami.MnemonicData.label: control.text
|
||||
|
||||
Shortcut {
|
||||
//in case of explicit & the button manages it by itself
|
||||
enabled: !(RegExp(/\&[^\&]/).test(control.text))
|
||||
sequence: control.Kirigami.MnemonicData.sequence
|
||||
onActivated: control.clicked()
|
||||
}
|
||||
|
||||
PlasmaCore.ColorScope.inherit: flat
|
||||
PlasmaCore.ColorScope.colorGroup: flat ? parent.PlasmaCore.ColorScope.colorGroup : PlasmaCore.Theme.ButtonColorGroup
|
||||
|
||||
|
@ -27,6 +27,13 @@ T.TabButton {
|
||||
Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.SecondaryControl
|
||||
Kirigami.MnemonicData.label: control.text
|
||||
|
||||
Shortcut {
|
||||
//in case of explicit & the button manages it by itself
|
||||
enabled: !(RegExp(/\&[^\&]/).test(control.text))
|
||||
sequence: control.Kirigami.MnemonicData.sequence
|
||||
onActivated: control.clicked()
|
||||
}
|
||||
|
||||
contentItem: GridLayout {
|
||||
columns: control.display == T.AbstractButton.TextBesideIcon ? 2 : 1
|
||||
PlasmaCore.IconItem {
|
||||
|
@ -32,6 +32,13 @@ T.ToolButton {
|
||||
Kirigami.MnemonicData.controlType: Kirigami.MnemonicData.SecondaryControl
|
||||
Kirigami.MnemonicData.label: control.text
|
||||
|
||||
Shortcut {
|
||||
//in case of explicit & the button manages it by itself
|
||||
enabled: !(RegExp(/\&[^\&]/).test(control.text))
|
||||
sequence: control.Kirigami.MnemonicData.sequence
|
||||
onActivated: control.clicked()
|
||||
}
|
||||
|
||||
flat: true
|
||||
|
||||
PlasmaCore.ColorScope.inherit: flat
|
||||
|
Loading…
x
Reference in New Issue
Block a user