fix #288679 and #269262: ensure support of set QStandardKey #4991
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The used QKeySequence::StandardKey may not be set on all Platforms, as described here (and in table above given link): https://doc.qt.io/archives/qt-4.8/qkeysequence.html#StandardKey-enum
This way the UI has an unsupported StandardKey as a shortcut (in the reported bug, it is Save-As, which has number 63). When now adding a manual shortcut, the Ms::Shortcut object has two shortcuts, the (unsupported) StandardKey and the manual entry. As a result,
QAction* Shortcut::action() const
will return the StandardKey and the added shortcut is never applied.This commit double checks that the OS supports the defined StandardKey, and if not, it blocks setting it as a shortcut.
Note: This also applies when clicking on "Reset All Preferences to Default", as the default shortcuts.xml contains the StandardKey causing these issues.