Results 1 to 4 of 4

Thread: Add QPushButton to cell in QTableView?

  1. #1
    Join Date
    May 2010
    Posts
    17
    Thanks
    6
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Add QPushButton to cell in QTableView?

    Hi to all
    I'm using QTableView I'd like to include in each row a QPushButton Is there a way to get a button into a QTableView cell?
    Thanks you.

  2. #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: Add QPushButton to cell in QTableView?

    No Problem with a custom delegate. See QAbstractItemView::setItemDelegateForColumn().

  3. The following user says thank you to Lykurg for this useful post:

    nikhil (13th July 2010)

  4. #3
    Join Date
    Jun 2010
    Posts
    86
    Thanks
    10
    Thanked 6 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Add QPushButton to cell in QTableView?

    If you aren't forced to use QTableView, you can use QTableWidget, it's straightforward
    Qt Code:
    1. //use this to add any widget to any cell in the table:
    2. QTableWidget::setCellWidget();
    3. // and this to get a pointer to this added widget:
    4. QTableWidget::cellWidget()
    To copy to clipboard, switch view to plain text mode 

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

    nikhil (13th July 2010), ShaChris23 (1st September 2010)

  6. #4
    Join Date
    May 2010
    Posts
    17
    Thanks
    6
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Symbian S60

    Default Re: Add QPushButton to cell in QTableView?

    is it Possible two split cell ?
    or merge horizontal headers in QTableWidget.
    Thanks in advance

Similar Threads

  1. how to color a cell in a QTableView
    By JeanC in forum Qt Programming
    Replies: 13
    Last Post: 9th September 2015, 10:08
  2. How to tell if QTableView cell is visible ?
    By steviekm3 in forum Qt Programming
    Replies: 0
    Last Post: 2nd March 2009, 10:04
  3. How to tell if cell in QTableView is visible ??
    By steviekm3 in forum Qt Programming
    Replies: 3
    Last Post: 27th February 2009, 17:57
  4. how to get data from cell of QTableview
    By yleesun in forum Qt Programming
    Replies: 2
    Last Post: 9th January 2009, 14:31
  5. How to select a cell in a QTableView
    By JeanC in forum Qt Programming
    Replies: 6
    Last Post: 6th February 2008, 13:20

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.