Results 1 to 4 of 4

Thread: mouse menu

  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default mouse menu

    hi, I'd like to visualize in my app a menu when I click mouseRightButton (like as window).
    Must I construct it myself or there is any class?thanks
    Regards

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: mouse menu

    You must construct it yourself using QPopupMenu.

  3. #3
    Join Date
    Jan 2006
    Location
    La Spezia,Italy
    Posts
    77
    Thanks
    9
    Thanked 5 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: mouse menu

    Hi,you have to reimplement QWidget::mousePressEvent(QMouseEvent*) in order to pop up your menu when the right button il clicked.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: mouse menu

    Quote Originally Posted by vratojr
    Hi,you have to reimplement QWidget::mousePressEvent(QMouseEvent*) in order to pop up your menu when the right button il clicked.
    No he doesn't. He has to reimplement QWidget::contextMenuEvent(QContextMenuEvent*). Remember that it doesn't have to be the RMB which triggers the event (for example if someone is left handed and has mouse buttons inverted).

  5. The following user says thank you to wysota for this useful post:

    vratojr (28th April 2006)

Similar Threads

  1. rigth click of mouse to create sub menu
    By SunnySan in forum Qt Programming
    Replies: 8
    Last Post: 12th November 2008, 11:29
  2. Changing mouse grabbing behavior?
    By FlyingSaucrDude in forum Qt Programming
    Replies: 0
    Last Post: 11th November 2008, 01:04
  3. Weird behaviour of mouse events and QMenu pop-ups
    By Ishark in forum Qt Programming
    Replies: 1
    Last Post: 7th August 2007, 07:46
  4. Replies: 2
    Last Post: 24th July 2006, 18:36
  5. QStackerWidget and mouse events
    By high_flyer in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2006, 19:25

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.