I can't spot anything particular in the code above that could be causing the problem. The bug must be elsewhere. I suggest you to double check the part of the code which sets the values.
Nevertheless you could check if the conversion from variant to int succeeds:
bool ok = false;
numberOfFails=listOfVariants.at(0).toInt(&ok);
if (!ok)
// failed
bool ok = false;
numberOfFails=listOfVariants.at(0).toInt(&ok);
if (!ok)
// failed
To copy to clipboard, switch view to plain text mode
By the way,
tempVariant=index.model()->data(index,Qt::DisplayRole);
// could be simply written as
tempVariant=index.data(Qt::DisplayRole);
// or even as
tempVariant=index.data();
tempVariant=index.model()->data(index,Qt::DisplayRole);
// could be simply written as
tempVariant=index.data(Qt::DisplayRole);
// or even as
tempVariant=index.data();
To copy to clipboard, switch view to plain text mode
It actually ends up calling the same what you have written but is more readable, isn't it..?
Bookmarks