QString str = "12";
bool ok;
int hex = str.toInt(&ok, 16); // 以16进制的形式转换 hex = 18
int dec = str.toInt(&ok, 10); // 以10进制的形式转换 dec = 12
QString str = "1234.56";
double val = str.toDouble(); // val == 1234.56
QString str1 = "1234.56";
str1.toFloat(); // returns 1234.56
long a = 63;
QString s = QString::number(a, 16); // s == "3f"
QString t = QString::number(a, 16).toUpper(); // t == "3F"
QString mon = QString("%1").arg(temp); //将temp转化字符串
QString x = "Nine pineapples";
QString y = x.mid(5, 4); // y == "pine"
QString z = x.mid(5); // z == "pineapples"
QString i; // current file's number
QString total; // number of files to process
QString fileName; // current file's name
QString status = QString("Processing file %1 of %2: %3").arg(i).arg(total).arg(fileName);
//First, arg(i) replaces %1. Then arg(total) replaces %2. Finally, arg(fileName) replaces %3.
QString str = "cxd";
int i = str.legth(); // i =3
QString x = "free";
QString y = "dom";
x.append(y); //x == "freedom"
QString str = "colour behaviour flavour neighbour";
str.replace(QString("ou"), QString("o"));
// str == "color behavior flavor neighbor"
QByteArray Data;
QString S = QString::fromAscii(Data.data());
QByteArray Data; //Data = ONP00001
QString Qnum = QString(Data.mid(5,3)); //Qnum = "001"
int Inum = Qnum.toInt(); //Inum = 1