Created attachment 130549 [details]
showcasing the bug, about window opens when shortcut is A, but not when it's Ctrl+A
Some shortcuts do not work if language is not english, tested with german.
STEPS TO REPRODUCE
1. Set language to german
2. Open elisa shorcuts editor
3. Set "About Elisa" action shortcut to Ctrl+A
4. Press Ctrl+A
About window DOES NOT open
About window DOES open
Operating System: openSUSE Tumbleweed 20200730
KDE Plasma Version: 5.19.4
KDE Frameworks Version: 5.72.0
Qt Version: 5.15.0
Kernel Version: 5.7.9-1-default
Elisa Version 20.4.3
I think this is because QAction shortcuts can be translated, ctrl, shift, left, page up etc.
But the QML Action doesn't know how to handle the translated shortcut,
which is what the shortcut property is set to
A "fix" would be to get the untranslated shortcut and use that for the qml action shortcut,
either by subclassing or as is done with the icon.
The downside is that when using a non english language the shortcuts in menus will be in english.
A possibly relevant merge request was started @ https://invent.kde.org/multimedia/elisa/-/merge_requests/336
Git commit fd858caf0e780f74275c56f4083517ef9e8056b4 by Nate Graham, on behalf of Olivier Trichet.
Committed on 08/03/2022 at 23:08.
Pushed by ngraham into branch 'master'.
Fix shortcut not working under non English locale
This change wraps calls to QAction::shortcut() done in QML files
to use the portable representation of QKeySequence.
The QKeySequence to QVariant operator return a string
representation using the native format not the portable format.
E.g., the sequence "Space", will be "Espace" under French locale.
The 'shortcut' attribute of QtQuick Action is stored as QVariant.
In qml file, when the QAction::shortcut() value (a QKeySequence)
is affected to a QtQuick Action shortcut, the previous operator is
used and the shortcut value may be bogus depending on translation.
// A QAction* with the Qt::Key_Space shortcut
property var playPauseAction: ElisaApplication.action("Play-Pause")
// - playPauseAction.shortcut returns QKeySequence(Qt::Key_Space).
// - QKeySequence(Qt::Key_Space) is transform into a QVariant that
// contains native text "Espace".
// - this QVariant is affected to shortcut: broken.
Related: bug 410110
M +6 -0 src/elisaapplication.cpp
M +1 -0 src/elisaapplication.h
M +6 -6 src/qml/ApplicationMenu.qml
M +8 -8 src/qml/ElisaMainWindow.qml
M +1 -1 src/qml/MediaPlayerControl.qml
M +1 -1 src/qml/NativeMenuItemFromAction.qml
M +7 -7 src/qml/NativeTrayMenu.qml