void Form::fileOpenSlot()
{
QString path=QFileDialog::getOpenFileName(this,"打开文件","./","File(*.txt *.doc *.html)");//设置打开的文件路径
QFile in(path);
if(!in.open(QIODevice::ReadOnly | QIODevice::Text))qDebug()<<"Can't open the file!"<
QByteArray Line=in.readAll();
QString str=codec->toUnicode(Line);//把Line转成UTF-8赋值给str 这里是关键
ui->textEdit->append(str);
in.close();
}