Results 1 to 2 of 2

Thread: qtablewidget popupmenu

  1. #1
    Join Date
    Jan 2008
    Posts
    6
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Exclamation qtablewidget popupmenu

    Dear,
    I have a qtablewidget. I want to add popupmenu when user right mouse click in item on qtablewidget.
    this is my script :
    Qt Code:
    1. void QTTapeUtil::on_tblWidgetInput_mousePressEvent( QMouseEvent * event )
    2. {
    3. int brs1 = tblWidgetInput->currentRow();
    4. QTableWidgetItem *texktnya = tblWidgetInput->item(brs1,0);
    5. if (texktnya)
    6. {
    7. if ( event->button() == Qt::RightButton )
    8. {
    9. QMenu menu(this);
    10. menu.addAction(coba1);
    11. menu.addAction(coba2);
    12. menu.exec();
    13. }
    14. }
    15. }
    To copy to clipboard, switch view to plain text mode 
    popupmenu show if item in tablewidget not empty. I try to use this script but I can not see popupmenu in my tablewidget. what wrong in my code? can you give me and example about popupmenu with tabelwidget (maybe copy paste operation)

    thank for your attention

    regardly

    toto
    Last edited by jpn; 6th February 2008 at 08:19. Reason: missing [code] tags

  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: qtablewidget popupmenu

    Did you try QWidget::contextMenuEventIt might be of help to you

Similar Threads

  1. QComboBox in QTableWidget : display troubles.
    By Nyphel in forum Qt Programming
    Replies: 2
    Last Post: 14th October 2007, 00:29
  2. QTableWidget issues
    By Djony in forum Qt Programming
    Replies: 42
    Last Post: 20th December 2006, 00:27
  3. print QTableWidget
    By chak_med in forum Qt Programming
    Replies: 3
    Last Post: 4th November 2006, 19:46
  4. QTableWidget editing question
    By Trasmeister in forum Qt Programming
    Replies: 1
    Last Post: 20th September 2006, 19:46
  5. Replies: 6
    Last Post: 5th March 2006, 22:05

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.