1、QString转换为char*
QString str;
char *msg;
QByteArray ba = str.toLain1();
msg = ba.data();
2、char*转换为QString
QString str;
char *msg;
str = QString::fromLocal8Bit(msg);
3、int转16进制字符串,并补0
int nRed = 255;
QString strRed = QString("%1").arg(nReg, 2, 16, QLatin1Char('0'));
4、QString转std::string
QString str1;
std::string str2;
str2 = str1.toStdString();
5、std::string转QString
std1 = QString("%1").arg(str2.c_str());