string s= "123";
QString str= QString::fromStdString(s);
含中文时的转换:
std::string str = "你好世界";
QString Name = QString::fromLocal8Bit(str.c_str());
QString str = "hello你好";
QByteArray data = str.toLocal8Bit();
std::string strdata = std::string(data);