Qt: 读取txt文本,中文乱码 //filePath 文件路径QFile file(filePath);//设置编码格式QTextCodec *codec = QTextCodec::codecForName("utf-8"); QTextCodec::setCodecForLocale(codec);if(!file.open(QIODevice::ReadOnly |QIODevice::Text))return;//获取内容QString content =file.readAll(); file.close...