i have simple item delegate from QStyledItemDelegate type inside its paint method i have this code . it renders fine , but the main thing here that i like the text to be
selectable for copy , and this dosn't work .


Qt Code:
  1. void ItemDelegate::paintBody( QPainter* painter,
  2. const QStyleOptionViewItem& option,
  3. const QModelIndex& index ) const {
  4. painter->save();
  5. QLabel *l = new QLabel();
  6. l->setTextFormat(Qt::RichText);
  7. l->setTextInteractionFlags(Qt::TextSelectableByMouse);
  8. l->setGeometry(option.rect);
  9. l->setText("This is test");
  10. l->setStyleSheet("QLabel { background-color : transparent; }");
  11. l->render(painter, option.rect.topLeft());
  12. painter->restore();
  13.  
  14. }
To copy to clipboard, switch view to plain text mode