Results 1 to 3 of 3

Thread: [SOLVED] Help Request - Table with Right-Click Context Menu

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    Join Date
    Aug 2008
    Location
    Algarve, Portugal
    Posts
    288
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60
    Thanks
    23
    Thanked 32 Times in 28 Posts

    Default Re: Help Request - Table with Right-Click Context Menu

    In your widget form change the property "contestMenuPolicy" (in your right pane) to DefaultContextMenu. Right click the widget and choose "Go to Slot" -> "CustomContextMenuRequest" . It will create a function for you. Now in that function add a QMenu:

    Qt Code:
    1. void someWidget::someWidgetContextMenu(QPoint pos)
    2. {
    3. QMenu menu;
    4. menu.addAction(someActionCreatedByYou1);
    5. menu.addAction(someActionCreatedByYou2);
    6. menu.exec(QCursor::pos());
    7. }
    To copy to clipboard, switch view to plain text mode 

    Voilá. You will have to add proper includes i.e #include<QMenu>
    __________________________________________________
    My projects: calculator MathGraphica ; SuperEpicMegaHero game ; GooglePlay ; bitbucket ; github
    Like my projects ? Buy me a kofi

  2. The following user says thank you to john_god for this useful post:

    Sarol (9th May 2011)

Similar Threads

  1. how to make the popup context menu disappear when click the options softkey ?
    By kongkong163 in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 18th January 2011, 03:39
  2. context menu for table
    By sattu in forum Qt Programming
    Replies: 2
    Last Post: 10th January 2011, 09:09
  3. Open a pop up menu when right click on any cell of the table
    By katta_ashish in forum Qt Programming
    Replies: 4
    Last Post: 9th September 2010, 07:06
  4. cancle right click context menu in qtwebkit
    By umen in forum Qt Programming
    Replies: 1
    Last Post: 6th August 2009, 21:06
  5. QWT right click window.. (Context Menu)
    By maveric in forum Qt Programming
    Replies: 4
    Last Post: 25th May 2008, 08:07

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.