在Qt中QString和std::string转换非常简单,
1、std::string转QString
代码语言:javascript复制std::string str = "hello wrold!";
QString qstr = QString::fromStdString(str);
2、QString转std::string
代码语言:javascript复制QString qstr = "hello wrold!";
std::string str = qstr.toStdString();