[Interest] Issue in drawing CheckBox using QStyle::drawPrimitive
Lijo Antony
lta at one.com
Tue Nov 27 15:07:58 CET 2012
On 11/27/2012 06:03 PM, Nurmi J-P wrote:
>> I am drawing a checkbox inside a custom delegate using
>> QStyle::drawPrimitive. I use this custom delegate to render items of a
>> QListView. Paint method of my custom delegate is as below,
>>
>>
>> void MytDelegate::paint(QPainter *painter,
>> const QStyleOptionViewItem &option,
>> const QModelIndex &index) const {
>>
>> QStyleOptionViewItem checkBoxStyle(option);
>>
>> // set checkBoxStyle.rect here
>>
>> checkBoxStyle.state = QStyle::State_On;
>
> This assignment overrides any state flags that were copied from 'option'. Use bitwise OR instead:
>
> checkBoxStyle.state |= QStyle::State_On;
>
> --
> J-P Nurmi
Thank you very much!
That was the problem. Now it is working fine.
Regards,
-lijo
More information about the Interest
mailing list