How to insert a QCheckBox into a QTableView?
The problem is that the checkbox changes when i insert it:
The third column is a checkbox.
How to insert a QCheckBox into a QTableView?
The problem is that the checkbox changes when i insert it:
The third column is a checkbox.
Simply make sure the flags() method for your model returns Qt::ItemIsUserCheckable and set its Qt::CheckStateRole to something valid.
Ok. So i subclassed QStandardItemModel, reimplement flags() and make it return
Qt::ItemIsUserCheckable.
Then i added a checkbox to model:
model->setData(index, Qt::Checked, Qt::CheckStateRole);
How to get some notification when the state of the checkbox is changed?
The QAbstractItemModel::dataChanged() signal is emitted when the CheckState is changed. To add your own signals for more specific data changes, you can reimplement the QAbstractItemModel::setData() function and emit custom signals from there..
J-P Nurmi
Bookmarks