顯示中文亂碼解決:
1,使用QStringLiteral ,變量爲已知字符串時
QStringLiteral("中文");
2,使用QTextCodec,theMsg 爲sprintf組合得到時
char theMsg[255] = "中文編碼顯示";
QTextCodec *codec = QTextCodec::codecForName("UTF-8");//指定QString的編碼方式
QString qStr = codec->toUnicode(theMsg);