QString std::string 相互转 含中文

std::string cstr;
QString qstring;

 

//QString str1 = "

D:\\参考手册\\BIM\\osg\\build1.OSGB";

//从std::string 到QString

qstring = QString(QString::fromLocal8Bit(cstr.c_str()));

//从QString 到 std::string
cstr = string((const char *)qstring.toLocal8Bit());

//不需要从gbk转到utf8
QString value_content = QString::fromStdString(vec[i].content);
QString value_classname = QString::fromStdString(vec[i].classname);

 

posted @ 2019-06-17 16:19  西北逍遥  阅读(3903)  评论(0编辑  收藏  举报