Drawing a Checkbox Checkmark primitive with colored background
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
Code:
focusrectOption.rect = layerRect;
focusrectOption.
backgroundColor = QColor(151,
165,
255);
QApplication::style()->drawPrimitive
(QStyle::PE_IndicatorCheckBox,
&focusrectOption, painter
);
and giving the QPainter a background color
Code:
QApplication::style()->drawPrimitive
(QStyle::PE_IndicatorCheckBox,
&checkBoxOption, painter
);
but it just doesnt draw anything. Any idea how to achieve this without having to draw the checkmark myself with lines?
Re: Drawing a Checkbox Checkmark primitive with colored background
Hi, do you have correct values for the .rect entries in the QStyleOption subclasses? Please check if focusrectOption.rect is non-zero after this line:
focusrectOption.rect = layerRect;
You probably have a similar line for checkBoxOption.
Ginsengelf