[Interest] Customize QTableView selection color

Murphy, Sean smurphy at walbro.com
Sun Feb 7 17:35:32 CET 2016


> > void customStyledItemDelegate::paint(QPainter *painter, const
> QStyleOptionViewItem &option, const QModelIndex &index) const
> > {
> >      QStyleOptionViewItem subop(option);
> " Just make a copy of the style option,"
> >      subop.state &= ~(QStyle::State_Selected);
> " reset the selection flag in the state variable"
> >      QStyledItemDelegate::paint(painter, subop, index);
> "and pass that on to the base class."
> > }
> >
> André

Sorry André!
Yes I did it exactly the way you said to and forgot to give you credit.

I just wanted to post the actual code back to the list in case someone searches for it later on.
Sean


More information about the Interest mailing list