I tried reformat data in cell (QTableView) with my custom model. But I just get crash. This is my code what I use..
{
if (role==Qt::DisplayRole && index.column()==3)
{
return index.model()->data(index, Qt::DisplayRole).toString().append("Rp. ");
}
}
QVariant customModel::data(const QModelIndex &index, int role) const
{
if (role==Qt::DisplayRole && index.column()==3)
{
return index.model()->data(index, Qt::DisplayRole).toString().append("Rp. ");
}
return QSqlQueryModel::data(index, role);
}
To copy to clipboard, switch view to plain text mode
Bookmarks