I need to customize the combo box which contains the text in the format " a rectangular color palette followed by a text description".
Iam using an a custom itemdelegate for a QComboBox . in the comboBox im checking the state of the Item and painting it according to my requirement like
if(option.state & QStyle::State_Selected)
{
painter->save();
QRect r = option.rect;
QRect textRect = r;
textRect.setX(r.x() + 8);
textRect.setWidth(r.width() - 10);
textRect.setY(r.y() -3);
textRect.setHeight(r.height() +2);
painter->drawText(textRect.left(), textRect.top() , textRect.width(), textRect.height() ,
flags, currText, &r);
painter->restore();
} else {
...
}
now i wanted to check if the role is a decorative role, if so then i have to add the pixmap and positioned it with item same like what i did for selected item inside paint function.
im not able to find how to paint a item with decorative role (image with text) .
How can I paint this text in the ItemDelegate ?
this is my actual requirement