Bug 437718 - Shortcut with Ampersand not correctly shown
Summary: Shortcut with Ampersand not correctly shown
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kdeclarative
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.82.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Marco Martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-26 22:13 UTC by Colour Delete
Modified: 2021-06-02 17:51 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.83


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Colour Delete 2021-05-26 22:13:59 UTC
SUMMARY
When adding a custom shortcut Meta+Shift+7 using System Settings
Instead of "Meta+&", "Meta+" is displayed under the "Custom shortcuts" label.
However, beside the name of the shortcut, "Meta+&" is correctly displayed.

STEPS TO REPRODUCE
1. Open "Shortcuts"
2. Add "Meta+Shift+7" as a shortcut to something (using the custom shortcuts feature)

OBSERVED RESULT
"Meta+" shown under "Custom shortcuts"

EXPECTED RESULT
"Meta+&" shown under "Custom shortcuts"

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: KDE neon 5.21 (User) on Linux 5.4.0-73-generic
KDE Plasma Version: 5.21.5 (X11)
KDE Frameworks Version: 5.82.0
Qt Version: 5.12.2

ADDITIONAL INFORMATION

Maybe this is because the ampersand isn't correctly escaped? (I think & is used for Qt stuff?)
Comment 1 Nate Graham 2021-05-27 15:45:43 UTC
Yeah, looks like it's not correctly escaped.
Comment 2 Colour Delete 2021-05-27 16:00:11 UTC
Hi,

I was just wondering, since I think the keyboard shortcut widget is used in many places, the fix would be on the widget, not the System Settings app?

Thanks,
Ken
Comment 3 Bug Janitor Service 2021-05-27 23:03:17 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kdeclarative/-/merge_requests/61
Comment 4 Nate Graham 2021-05-27 23:07:28 UTC
(In reply to Colour Delete from comment #2)
> Hi,
> 
> I was just wondering, since I think the keyboard shortcut widget is used in
> many places, the fix would be on the widget, not the System Settings app?
> 
> Thanks,
> Ken
Yup. :)
Comment 5 Colour Delete 2021-05-27 23:31:41 UTC
Understood; thank you!
Comment 6 Nate Graham 2021-06-02 17:51:36 UTC
Git commit ca86b73f754947b1a2c1a0223c81634480c3a3f1 by Nate Graham.
Committed on 27/05/2021 at 22:59.
Pushed by ngraham into branch 'master'.

[KeySequenceItem] Display ampersands in shortcuts

We have to replace the single ampersand that we get back from
QKeySequence::toString() to be two ampersands, because the QQC2 Button
that will display this string interprets a single ampersand as a
mnemonic and hides it, which is not correct for our use of it here.
FIXED-IN: 5.83

M  +6    -1    src/qmlcontrols/kquickcontrols/KeySequenceItem.qml

https://invent.kde.org/frameworks/kdeclarative/commit/ca86b73f754947b1a2c1a0223c81634480c3a3f1