FYI, this would have been enough:

Qt Code:
  1. void LineEditDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
  2. {
  3. QStyleOptionViewItem noSelectionOption(option);
  4. noSelectionOption.state &= ~QStyle::State_Selected;
  5. QStyledItemDelegate::paint(painter, noSelectionOption, index);
  6. }
To copy to clipboard, switch view to plain text mode