I tried reformat data in cell (QTableView) with my custom model. But I just get crash. This is my code what I use..

Qt Code:
  1. QVariant customModel::data(const QModelIndex &index, int role) const
  2. {
  3.  
  4. if (role==Qt::DisplayRole && index.column()==3)
  5. {
  6. return index.model()->data(index, Qt::DisplayRole).toString().append("Rp. ");
  7. }
  8.  
  9. return QSqlQueryModel::data(index, role);
  10. }
To copy to clipboard, switch view to plain text mode