1、QMessageBox显示中文乱码
解决方法:
QMessageBox::warning(this, "Note", QString::fromLocal8Bit("中文测试"));
2、读取txt文档乱码
解决方法:
QFile file(m_strFile);
if(file.open(QIODevice::ReadOnly | QIODevice::Text))
{
while(!file.atEnd())
{
QString s = codec->toUnicode(file.readLine());
qDebug << s;
}
}