Thank you for your guiding. I finally solved with the following:
{
if (value.isValid() && role == Qt::DisplayRole && index.column() == 9) {
int rand=index.row();
int val=index.sibling(rand,8).data().toInt();
if(val==99){
return value.toString().replace(value.toString(),"0.00");
}
}
return value;
}
QVariant ModelLProd::data(const QModelIndex &index, int role) const
{
QVariant value = QSqlQueryModel::data(index, role);
if (value.isValid() && role == Qt::DisplayRole && index.column() == 9) {
int rand=index.row();
int val=index.sibling(rand,8).data().toInt();
if(val==99){
return value.toString().replace(value.toString(),"0.00");
}
}
return value;
}
To copy to clipboard, switch view to plain text mode
I was looking at the issue the wrong way.
Bookmarks