How can I add a checkbox/radio button to QTableWidget

user664305 picture user664305 · Mar 20, 2011 · Viewed 46.5k times · Source

How can I add a checkbox/radiobutton/combobox to a QTableWidget or a QListWidget?

Answer

Pie_Jesu picture Pie_Jesu · Mar 20, 2011

There is two methods:

void QTableWidget::setCellWidget ( int row, int column, QWidget * widget )

and

void QListWidget::setItemWidget ( QListWidgetItem * item, QWidget * widget )

They allow to insert any widget and other controls that inherit QWidget. Checkbox/radio button/combobox do inherit from QWidget.