your program crashes, because you should write
Qt Code:
  1. QString imgFile = QSqlTableModel::data(idx, Qt::DisplayRole);
To copy to clipboard, switch view to plain text mode 
instead of
Qt Code:
  1. QString imgFile = idx.data().toString();
To copy to clipboard, switch view to plain text mode 
try to exactly repeat my previous code...
Qt Code:
  1. QVariant PersonasModel::data(const QModelIndex &idx, int role) const
  2. {
  3. if ( idx.column() == 5 )
  4. {
  5. QString imgFile = QSqlTableModel::data( idx, Qt::DisplayRole );
  6. if ( Qt::DisplayRole == role )
  7. {
  8. return QString();
  9. }
  10. if ( !QFile::exists( imgFile )
  11. {
  12. imgFile = ":/centinela/images/picture_unavailable.jpg";
  13. }
  14. QPixmap pixmap( imgFile );
  15. if ( role == Qt::DecorationRole )
  16. {
  17. return pixmap;
  18. }
  19. if(role == Qt::SizeHintRole)
  20. {
  21. return pixmap.size();
  22. }
  23. }
  24. return QSqlTableModel::data( idx, role );
  25. }
To copy to clipboard, switch view to plain text mode 
should I call QTableView::resizeRowsToContents() ?
honestly, I don't know. try ...