I would like add QPushButtons to my QTableView. How can this be done with Qt? Is it possible to specify which column holds the button If I use QItemDelegate?
Asked
Active
Viewed 1,110 times
1 Answers
2
You've got to create your own PushButtonDelegate by subclassing QItemDelegate
.
QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelegate * delegate)
will set your delegate for the specified column of a view.
The implementation of the delegate depends on it's desired behavior. E.g. you can implement only createEditor()
, setEditorData()
and setModelData()
to get the button to appear when the user starts editing a cell, or you can change the cell look completely by reimplementing the delegate's paint()
method.
For more information see this. Also take a look at the Qt delegate examples.

VVV
- 499
- 4
- 12