Results 1 to 3 of 3

Thread: crtl + click on a menu item

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jun 2015
    Location
    California, USA
    Posts
    61
    Thanks
    43
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11

    Default crtl + click on a menu item

    Is it possible to call a unique function when someone holds ctrl and clicks on a menu entry (e.g. File → Open)?

  2. #2
    Join Date
    Apr 2013
    Location
    Prague
    Posts
    258
    Thanks
    3
    Thanked 65 Times in 59 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: crtl + click on a menu item

    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.)

  3. The following user says thank you to Radek for this useful post:

    ravas (26th June 2015)

  4. #3
    Join Date
    Jun 2015
    Location
    California, USA
    Posts
    61
    Thanks
    43
    Thanked 1 Time in 1 Post
    Qt products
    Qt5
    Platforms
    MacOS X Unix/X11

    Default Re: crtl + click on a menu item

    Thank you.

Similar Threads

  1. Replies: 4
    Last Post: 11th January 2014, 03:06
  2. Qt show modal dialog (.ui) on menu item click
    By tomorrow in forum Newbie
    Replies: 7
    Last Post: 16th November 2013, 09:58
  3. Replies: 4
    Last Post: 19th August 2013, 09:53
  4. Replies: 1
    Last Post: 4th November 2011, 11:25
  5. Right click menu
    By ^NyAw^ in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:22

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.