从Qt5开始,Qt的运行时编码只需要一个函数即可设置完毕

QTextCodec * c = QTextCodec::codecForName("GBK");//中文一般是GBK        
if(c){
    QTextCodec::setCodecForLocale(c);
}