qt - Should I use KeyPressEvent or QAction to implement keypresses? -


in qt, either implementing keypressevent or creating qaction , assigning key combination allow me act based on keyboard.

which of these methods preferred?

you should use qaction whenever same event triggered key sequence want may triggered through other ways menu, toolbar or other buttons. way can use same action on several widgets should same trick.

excerpt qaction doc:

the qaction class provides abstract user interface action can inserted widgets.

in applications many common commands can invoked via menus, toolbar buttons, , keyboard shortcuts. since user expects each command performed in same way, regardless of user interface used, useful represent each command action.


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -