If you want custom painting then you have to do the work to honour selections and the like and adjust the colours accordingly. You use the data in the QStyleOptionViewItem to achieve that, e.g:
Qt Code:
  1. // something like this
  2. painter->save();
  3. if (option.state & QStyle::State_Selected) {
  4. painter->fillRect(option.rect, option.palette.highlight());
  5. painter->setPen(...); // use option.palette.highlightedText()
  6. painter->drawText(...);
  7. }
  8. else {
  9. painter->fillRect(option.rect, option.palette.base());
  10. painter->setPen(...); // use option.palette.text()
  11. painter->drawText(...);
  12. }
  13. painter->restore();
To copy to clipboard, switch view to plain text mode 
That's why I suggested just overriding QStyledItemDelegate::displayText() to change just the text that the default delegate painting then renders.