How to insert QPushButton into TableView?

izidor picture izidor · May 4, 2010 · Viewed 9.5k times · Source

I am implementing QAbstractTableModel and I would like to insert a QPushButton in the last column of each row. When users click on this button, a new window is shown with more information about this row.

Do you have any idea how to insert the button? I know about delegating system but all examples are only about "how to edit color with the combo box"...

Answer

PDH picture PDH · May 15, 2014

You can use

QPushButton* viewButton = new QPushButton("View");    
tableView->setIndexWidget(model->index(counter,2), viewButton);