QString turn int
Direct call toInt () function
Example:
QString str("100");
int tmp = str.toInt();
or:
bool ok;
QString str("100");
int tmp = str.toInt(&ok);
Note: ok indicates whether the conversion is successful, success is ok is true, fails ok to false.
2) int turn QString
QString::number();
Example:
int tmp = 100;
QString str = QString::number(tmp);