[solved]shortcut
-
You can put an ampersand in the buttons text eg.
@
auto button = new QPushButton("Hit &me!", parent);
@
You can also do that in the designer's properties. It will assign Alt+m to that button (whatever letter after &).A more general way is to create a QAction.
Connect button clicked() signal to the action's trigger() slot.
Set a "shortcut":http://qt-project.org/doc/qt-5/qaction.html#shortcut-prop.
Set global (or whatever you want) shortcut "context":http://qt-project.org/doc/qt-5/qaction.html#shortcutContext-prop.
Connect to the triggered() signal of the action and do your work there.