Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Passing control+keypress instructions from one form to another
donquibeats last edited by donquibeats
In my PyQt5 application, I've got two
QDialogwindows open, and the first one has a
QMenuBarwith various options. Some of these have keyboard shortcuts, e.g. Ctrl+S for Save, Ctrl+F for Find etc.
If the user presses Ctrl+S or Ctrl+F while the other dialog has focus, is there any way of passing this to the first dialog, so that the save or find functions are triggered?
I have tried doing this with passing the parameter of
keyPressEvent()from the second form to
keyPressEvent()on the first form, but this only seems to pass individual key values, not Ctrl+key combinations etc., so the first form gets "Ctrl" and then "S" but never a "Ctrl+S" trigger.
Is there a way I could pass these key combination triggers to the first form, without having to code each one individually for the second form? (There are quite a few of them.)
Pl45m4 last edited by Pl45m4
Set the shortcuts' context to
donquibeats last edited by
Exactly what I needed, works immediately. Thanks very much!
Pablo J. Rogina last edited by
great, so don't forget to mark your post as solved then!