PDA

View Full Version : crtl + click on a menu item



ravas
25th June 2015, 18:16
Is it possible to call a unique function when someone holds ctrl and clicks on a menu entry (e.g. File → Open)?

Radek
25th June 2015, 19:22
Surely. IMO, you need to derive from QAction, define your "ctrl-clicked" signal, reimplement event() and check with ctrl click in it. At the end of the handler, call the base handler. Now create a menu item using your QAction. The menu item should react on ctrl clicks. IMO, in the Designer, it should be possible to promote the menu item to your QAction so that the integration is complete. (I've never done such things, all this are only thoughts.)

ravas
26th June 2015, 03:53
Thank you. :cool: