Results 1 to 2 of 2

Thread: QTable context menu

  1. #1
    Join Date
    Jun 2008
    Posts
    4
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default QTable context menu

    I have a context menu associated with a widget. The widget has a QTableView as a child. The context menu displays outside of the Table. In the contextMenuEvent I want to calculate if the mouse is over a row of data before I pop up the menu. I also need to set the current row of the table before I do the pop up.

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QTable context menu

    You can override the mousePressEvent for the QTableView and check childAt(event->pos()) is valid or not.
    If its valid, you can get the row from the index of the child.

    Hope this helps

Similar Threads

  1. Context Menu on QTableWidget
    By ankurjain in forum Qt Programming
    Replies: 9
    Last Post: 17th December 2009, 09:52
  2. context menu problem
    By dreamer in forum Qt Programming
    Replies: 1
    Last Post: 25th May 2008, 13:18
  3. Replies: 4
    Last Post: 25th June 2007, 20:40
  4. QTreeWidget Context Menu
    By ^NyAw^ in forum Qt Programming
    Replies: 2
    Last Post: 11th May 2007, 11:24
  5. Misplaced Context Menu
    By kandalf in forum Qt Programming
    Replies: 6
    Last Post: 18th February 2007, 04:28

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.