Based on the information Dmitry provided above I've implemented the following paint method in my delegate for rendering my button and checkbox. Obviously this needs an editorEvent() to do anything I can add this also if it proves useful.
void DDUTableDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option,
const QModelIndex& index) const
{
int col = index.column();
if (col == VIEW_COLUMN) {
// Draw our checkbox indicator
bool value = index.data(Qt::EditRole).toBool();
QStyleOptionButton checkbox_indicator;
// Set our button state to enabled
checkbox_indicator.state |= QStyle::State_Enabled;
checkbox_indicator.state |= (value) ? QStyle::State_On : QStyle::State_Off;
// Get our deimensions
checkbox_indicator.rect = QApplication::style()->subElementRect( QStyle::SE_CheckBoxIndicator, &checkbox_indicator, NULL );
// Position our indicator
const int x = option.rect.center().x() - checkbox_indicator.rect.width() / 2;
const int y = option.rect.center().y() - checkbox_indicator.rect.height() / 2;
checkbox_indicator.rect.moveTo( x, y );
if (option.state & QStyle::State_Selected) {
painter->fillRect(option.rect, option.palette.highlight());
}
QApplication::style()->drawControl( QStyle::CE_CheckBox, &checkbox_indicator, painter );
}
else if (col == TEST_COLUMN) {
bool value = index.data(Qt::EditRole).toBool();
QStyleOptionButton button;
// Set our button to fill the entire cell contents
button.rect = option.rect;
// Set our button state to enabled
button.state |= QStyle::State_Enabled;
if (value) {
button.state |= QStyle::State_Sunken;
button.text = STOP_TEST;
}
else {
button.text = START_TEST;
}
if (option.state & QStyle::State_Selected) {
painter->fillRect(option.rect, option.palette.highlight());
}
QApplication::style()->drawControl(QStyle::CE_PushButton, &button, painter);
}
}