feat(hotkey): Add support for numeric keypad hotkeys - #342
Open
kenmcgaugh wants to merge 1 commit into
Open
Conversation
…dent hotkeys.
Currently hotkeys cannot be assigned independently to the keys on the numeric keypad. This is implemented by modifying and extending the xstudio key_names list with "numpad" keys. Most already existed but had some conflicts. Then the 3 areas I located where Qt QKeyEvent's are translated into xstudio keys have been modified to test if Qt::KeypadModifier is active and if so it remaps the keys to their "numpad" variant.
Note that other modifier keys can still be uesd with the numeric keypad keys, including the "Shift" modifier. Holding the "Shift" key down doesn't change the meaning of the numpad key like it does elsewhere. In other words, pressing Shift+9 on the numeric keypad results in "numpad 9"+Shift rather than "PageUp". Likewise for using the NumLock key. It has no effect on the hotkey assignments.
This has been tested under MacOS and Linux using a US keyboard. I have added support for European keyboards that use a comma (',') rather than a full-stop ('.') on the numeric keypad, but I have no way of testing that. I'm also unsure if this works under Windows.
An alternative approach to implementing this would have been to engineer in support for Qt::KeypadModifier->KeyboardModifier::KeypadModifier, but I kept hitting roadblocks trying that way.
Signed-off-by: Ken McGaugh <ken@mcgaugh.co.uk>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Add support for using the numeric keypad keys as indpendent hotkeys.
Currently hotkeys cannot be assigned independently to the keys on the numeric keypad. This is implemented by modifying and extending the xstudio key_names list with "numpad" keys. Most already existed but had some conflicts. Then the 3 areas I located where Qt QKeyEvent's are translated into xstudio keys have been modified to test if Qt::KeypadModifier is active and if so it remaps the keys to their "numpad" variant.
Note that other modifier keys can still be uesd with the numeric keypad keys, including the "Shift" modifier. Holding the "Shift" key down doesn't change the meaning of the numpad key like it does elsewhere. In other words, pressing Shift+9 on the numeric keypad results in "numpad 9"+Shift rather than "PageUp". Likewise for using the NumLock key. It has no effect on the hotkey assignments.
This has been tested under MacOS and Linux using a US keyboard. I have added support for European keyboards that use a comma (',') rather than a full-stop ('.') on the numeric keypad, but I have no way of testing that. I'm also unsure if this works under Windows.
An alternative approach to implementing this would have been to engineer in support for Qt::KeypadModifier->KeyboardModifier::KeypadModifier, but I kept hitting roadblocks trying that way.