How to change appearance of QComboBox's items?

Viewed 100

I want to set appearance of QComboBox's items like this:

enter image description here

Modern environments (like windows, mac, etc) don't contain similar styles, so I suppose repainting is the best way to solve this problem. Qt doc says that reimplementing paint method of QStyledItemDelegate class can help, but I cannot understand, how can I retrieve specific information from arguments of such method (example from qt 5.5):

void QStyledItemDelegate::paint(QPainter *painter,const QStyleOptionViewItem&option, const QModelIndex &index) const
{
   //how to get specific info from index object?
}

Maybe is there another best and elegant way of solving this problem?

0 Answers
Related