PDA

View Full Version : Can QPushButton be put into a QTableWidget cell?



ShaChris23
26th August 2010, 00:59
I would like to create a table whose cells are buttons like:

5098

Can one put a QPushButton into a QTableWidget cell?

tbscope
26th August 2010, 05:25
Yes, via a delegate.
Check the documentation and examples.

ShaChris23
26th August 2010, 16:53
@tbscope, thank you for your reply.

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

tbscope
27th August 2010, 05:25
That I can do:
http://doc.qt.nokia.com/4.6/itemviews-spinboxdelegate.html
http://doc.qt.nokia.com/4.6/itemviews-stardelegate.html
http://doc.qt.nokia.com/4.6/itemviews-pixelator.html
...

http://doc.qt.nokia.com/4.6/model-view-delegate.html

ShaChris23
1st September 2010, 00:18
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.