I am using a QItemDelegate combined with the QTableView's IsUserCheckable flag to draw a centered checkbox column. All has been working fine until I have enabled row selection for the table.
When selection occurs, the blue selection background is the only thing painted, and the checkboxes are no longer seen.
The following is my code I use to paint the checkbox from within the delegate.
void CheckboxDelegate::drawCheck(QPainter* painter, QStyleOptionViewItem const& option, QRect const& rect, Qt::CheckState state) const
{
QSize size = check(option, option.rect, Qt::Checked).size();
QRect checkboxRect = QStyle::alignedRect(option.direction, Qt::AlignCenter, size, option.rect);
QItemDelegate::drawCheck(painter, option, checkboxRect, state);
}
Any ideas as to why this is not painting correctly when a selection is made?