How to get the digits value elegantly?
QChar qc('4');
int val=-1;
if(qc.isDigit()){
val = qc.toLatin1() - '0';
}
does not look that good.
Neither does converting to QString
since creating a QString object and start parsing just for this purpose seems to be overkill.
QChar qc('4');
int val=-1;
if(qc.isDigit()){
val = QString(qc).toInt();
}
Any better options or interfaces that I have missed?