Results 1 to 3 of 3

Thread: How can I show a popup when right mouse button is pressed?

  1. #1
    Join Date
    Apr 2009
    Posts
    132
    Thanks
    67
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default How can I show a popup when right mouse button is pressed?

    Hi mates!

    I create a popup menu using QMenu, and my UI have a QTableWidget.
    I'd like that if the user press right click over my QTableWidget, this popup shows.

    How should I do that?
    Using signals/slots, create a new object and rewrrite pressMouseButton...?

    Any advice?

    Thanks in advance.

  2. The following 2 users say thank you to ricardo for this useful post:


  3. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Wiki edits
    5

    Default Re: How can I show a popup when right mouse button is pressed?

    Simply use QWidget::customContextMenuRequested(const QPoint &pos) and check if at this position is a cell of your table widget. (see QTableView::indexAt())

  4. The following 2 users say thank you to Lykurg for this useful post:

    ricardo (13th May 2009)

  5. #3
    Join Date
    Apr 2009
    Posts
    132
    Thanks
    67
    Thanked 6 Times in 5 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How can I show a popup when right mouse button is pressed?

    I got it!

    Thanks a lot.

  6. The following user says thank you to ricardo for this useful post:


Similar Threads

  1. QSlider and right mouse button
    By Abnormalia in forum Qt Programming
    Replies: 4
    Last Post: 17th March 2009, 13:13
  2. Changing mouse grabbing behavior?
    By FlyingSaucrDude in forum Qt Programming
    Replies: 0
    Last Post: 11th November 2008, 02:04
  3. DragMode switching based on key & mouse button?
    By mooreaa in forum Qt Programming
    Replies: 1
    Last Post: 1st July 2008, 11:42
  4. problem about mouse button events
    By vql in forum Qt Programming
    Replies: 1
    Last Post: 29th April 2008, 11:14
  5. Replies: 4
    Last Post: 4th February 2008, 07:16

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