If idx is an index of the same ApplicantTableModel instance (which it should be, otherwise the usage is incorrect) idx.data() will call idx.model()->data(), i.e. the very same ApplicantTableModel::data() function we’re looking at => infinite recursion, which leads to stack overflow/crash.
From your code I guess what you want might be
QVariant ApplicantTableModel::data(const QModelIndex &idx, int role) const
{
if (!idx.isValid())
return QVariant();
if (idx.column() == 10 && role == Qt::DisplayRole) {
if(QSqlTableModel::data(idx,role).toString() == “0")
return "-";
else
return "+";
}
return QSqlTableModel::data(idx, role);
}
I.e. call get the value of data from the base class implementation and change that in this special case.