Skip to content

feat(hotkey): Add support for numeric keypad hotkeys - #342

Open
kenmcgaugh wants to merge 1 commit into
AcademySoftwareFoundation:developfrom
kenmcgaugh:pr_numpad_hotkeys
Open

feat(hotkey): Add support for numeric keypad hotkeys#342
kenmcgaugh wants to merge 1 commit into
AcademySoftwareFoundation:developfrom
kenmcgaugh:pr_numpad_hotkeys

Conversation

@kenmcgaugh

Copy link
Copy Markdown
Contributor

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.

…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant