-
Key definition format
Used to define actions on keys in anywhere you can edit text.
'prekey' : { 'key_tab' : '@me.insertindentation()', 'key_backtab' : '@me.removeindentation()', }, 'postkey' : { 'key_enter' : '@me.autoindent()', 'key_return' : '@me.autoindent()', },
The basic structure. You can used named elements, number values and char values as keys. Each of the keys will then either have a direct element value that is the action to run or you can add a key modifier structure to filter on control key as well as just the main key.
Prekey actions
This is filters run before the default key action is run. If this method return True, it will stop the default key action. This can be used to stop keys from being pressed. Ex. enter not allowed, can be done by adding a default action on the 'key_enter' of type True.
Postkey actions
These action can not stop the default action to happen as they are done after the default key action. They can be used to do something extra after the default action has been done. Ex. add the same indent in a editor as the line you came from on key_enter.
The valid keys as text
'key_escape' 'key_tab' 'key_backtab' 'key_backspace' 'key_return' 'key_enter' 'key_insert' 'key_delete' 'key_pause' 'key_print' 'key_sysreq' 'key_clear' 'key_home' 'key_end' 'key_left' 'key_up' 'key_right' 'key_down' 'key_pageup' 'key_pagedown' 'key_shift' 'key_control' 'key_meta' 'key_alt' 'key_altgr' 'key_capslock' 'key_numLock' 'key_scrolllock' 'key_f1' 'key_f2' 'key_f3' 'key_f4' 'key_f5' 'key_f6' 'key_f7' 'key_f8' 'key_f9' 'key_f10' 'key_f11' 'key_f12'
All the keys that can be written as text string. You can also use a single character for all the normal chars like 'A', 'a' etc. or a numeric value for all not in this list. The list is just the most commonly used characters. To get the full list, look up the Qt documentation on key enums.
The valid modifiers
'no' 'shift' 'control' 'alt' 'meta' 'keypad'
This are the only supported. If you want to use any, make sure that you add the normal action to handle without modifiers as a 'no' modifier.