How could I register a global short cut key for a certain QPushButton? Especially when the QPushButton is not a direct child of the main window.
Asked
Active
Viewed 291 times
0
-
Do you mean global shortcut for whole OS(you should catch this shortcut if user doesn't work with your window)? – Jablonski Feb 26 '15 at 08:15
-
Yes. For example, how could I register the windows button for certain application and prevent the windows start menu from popping out? – Nyaruko Feb 26 '15 at 08:17
-
I know how to create global shortcut for something like Ctrl + Something, but single Windows key is not a shortcut, I catched windows key pressing a few minutes ago with global keyboard low-level hook, it works good, but I don't know how to disable Start menu appearing – Jablonski Feb 26 '15 at 08:43
2 Answers
0
Usually you create a QAction
and you add it to a menu or a toolbar. You can set a shortcut, icon, tooltip etc, this is not exactly a QPushButton but it's pretty close and it is easy to link your action to any slot of your convenience.
But if you just want to capture a shortcut or a key to steal it from the OS, MasterAler is right, go for QKeySequence
or QShortcut
.

ymoreau
- 3,402
- 1
- 22
- 60