Hi,

title says it all, I want to draw the checkmark with a colored background in the paint function of a custom delegate derived from QSytledItemDelegate. So far I tried

Qt Code:
  1. QStyleOptionFocusRect focusrectOption;
  2. focusrectOption.rect = layerRect;
  3. focusrectOption.backgroundColor = QColor(151,165,255);
  4.  
  5. QApplication::style()->drawPrimitive(QStyle::PE_IndicatorCheckBox, &focusrectOption, painter);
To copy to clipboard, switch view to plain text mode 

and giving the QPainter a background color

Qt Code:
  1. painter->setBackground(QBrush(QColor(151,165,255)));
  2. QApplication::style()->drawPrimitive(QStyle::PE_IndicatorCheckBox, &checkBoxOption, painter);
To copy to clipboard, switch view to plain text mode 

but it just doesnt draw anything. Any idea how to achieve this without having to draw the checkmark myself with lines?