Results 1 to 5 of 5

Thread: Can QPushButton be put into a QTableWidget cell?

  1. #1
    Join Date
    Apr 2007
    Posts
    62
    Thanks
    43
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Can QPushButton be put into a QTableWidget cell?

    I would like to create a table whose cells are buttons like:

    table_of_buttons.PNG

    Can one put a QPushButton into a QTableWidget cell?

  2. #2
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Can QPushButton be put into a QTableWidget cell?

    Yes, via a delegate.
    Check the documentation and examples.

  3. #3
    Join Date
    Apr 2007
    Posts
    62
    Thanks
    43
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Can QPushButton be put into a QTableWidget cell?

    @tbscope, thank you for your reply.

    Could you please point to some specific example, that'd be helpful. Thanks!

  4. #4
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

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

    ShaChris23 (27th August 2010)

  6. #5
    Join Date
    Apr 2007
    Posts
    62
    Thanks
    43
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Can QPushButton be put into a QTableWidget cell?

    After consulting with a co-worker, maybe it's easier to use QTableWidget::setCellWidget(int row, int column, QWidget * widget ) ...by passing a QPushButton * into the QWidget * parameter.

Similar Threads

  1. repaint a cell or row in QTableWidget
    By alphaqt in forum Newbie
    Replies: 6
    Last Post: 26th June 2012, 12:21
  2. Add QPushButton to cell in QTableView?
    By nikhil in forum Qt Programming
    Replies: 3
    Last Post: 14th July 2010, 10:01
  3. Replies: 1
    Last Post: 7th December 2009, 19:56
  4. Close a QtableWidget cell
    By SailinShoes in forum Qt Programming
    Replies: 2
    Last Post: 7th March 2008, 15:03
  5. A QListWidget in a QTableWidget cell ?
    By Nyphel in forum Newbie
    Replies: 4
    Last Post: 11th April 2007, 11:46

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.