赞
踩
std::string str = "中文";
QString::fromStdString(str) == QString::fromLocal8Bit("中文")
上述代码验证无误。
注意中文字符串不能直接比较,比如下面这样:
std::string str = "中文";
QString::fromStdString(str) == "中文"
或者:
std::string str = "中文";
QString::fromStdString(str) == QString("中文")
都是不可以的
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。