转载地址: https://blog.csdn.net/u014272404/article/details/51680060
在给控件添加中文的时候 通常都会产生乱码,处理方法:
1. 在main.cpp中添加
#include<QTextCodec>
QTextCodec::setCodecForTr(QTextCode::codecForLocale() ); // 取得本地操作系统的语系
在mainWindow.cpp中处理:
ui->pushButton ->setText( tr(" 中国 "));
相关参考文献 : https://blog.csdn.net/fengjliu/article/details/48048349