PDA

View Full Version : Reformat data in cell



wirasto
29th November 2009, 01:02
I tried reformat data in cell (QTableView) with my custom model. But I just get crash. This is my code what I use..



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);
}

caduel
29th November 2009, 09:21
you call yourself (in the call to data): recursion, endless loop, stack overflow, crash...

call the base class's data() function instead.