QT5中QByteArray转QString中文乱码
1.添加头文件
#include <QTextCodec>
2.用QTextCodec 设置格式转换
QByteArray barr;
barr.insert(0,(char*)(pMsg->wParam));
QTextCodec *tc = QTextCodec::codecForName("GBK");
QString tmpQStr = tc->toUnicode(barr);
this->ui.send_btn->setText(tmpQStr);