I am using QTableView\'s checkbox flag of Qt::ItemIsUserCheckable to display a checkbox in a table cell.
After reading some things on alignment in an attempt to
After further investigation into delegate options I found a nice reference (unfortunately no longer available) and came up with the following hybrid using a QItemDelegate and IsUserCheckable.
Essentially, you need to extend QItemDelegate, and reimplement, using the drawCheck function to center and use the editorEvent
to handle mouse and keyboard events while setting the model with the appropriate state.
void drawCheck(QPainter* painter, QStyleOptionViewItem const& option, QRect const& rect, Qt::CheckState state) const
and
bool editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &option, const QModelIndex &index)
Also see this similar question here...