I have created one table by using QTableview
and QAbstractTableModel
.
In one of the cells, I want to add one help button in the r
setIndexWidget worked for me. Example:
QPushButton* helpButton = new QPushButton("Help");
tableView->setIndexWidget(model->index(position,COLUMN_NUMBER), helpButton);
If you just want to add a button and do something on click of it, adding a button using setIndexWidget() works fine. I believe we don't need the cumbersome paint method or implementing delegates.