Trigger keyboard shortcut keys using button widget.
-
A keyboard shortcut is supposed to be triggered by entering the specified key sequence. An external trigger is not implemented. If it appears to be needed, there is something wrong in the application design.
Whatever is connected to
QShortCut::activated
, can be connected in parallel toQPushButton::clicked
. That gives you the expected result. -
Hi @Axel-Spoerl ,
Thanks for replying!
I have to develop application to record wayland/weston screen. Keyboard(super+r) is working fine but I didn't find command line tool to record screen. So I decided to map keyboard shortcuts.
Please help!!
-
@Axel-Spoerl, and I, thought you meant a keyboard shortcut within a Qt application you are writing, e.g. to trigger its menus. For that you should call the slot directly instead. But are you talking about some global keyboard shortcut recognised and dealt with by the desktop window/keyboard manager, nothing to do with a Qt application? You just happen to want to invoke that from a Qt application you are writing, but the key shortcut is aimed at the desktop manager?
-
The question in this thread is how to trigger a keyboard shortcut, e.g. with a "button widget".
That's quite different from a screen recorder. Keeping us in the dark is stealing volunteers' time.If you want to record key events (and probably mouse events, too), you need to install an event filter on the recording level (if you want to record everything,
QApplication
level - respectivelyqApp->installEventFilter(filterObject)
). There you can intercept and record all events needed.Keep in mind, that for security reasons the window manager "keep" certain shortcuts for itself. For instance, the application will not even see CTRL+ALT+DEL (or what ever is the screen-lock shortcut on your system).