how to convert std::string to QString
I have a problem:
std::string str("character/test/raw");
qDebug() << QString::fromStdString(str);
and the output is:
"]AIIIIIIIIIIIIIIIIIIIIIIIIIIIII"
I think the problem is in encoding but don't know how to fix it. Please 开发者_如何学运维help
string to const char*, then to qstring
std::string str("character/test/raw");
QString qstr(str.c_str());
qDebug() << qstr;
Is your QT compiled with STL compatible enabled option?
Maybe you can use fromUtf8 or one of other static functions of QString.
精彩评论