QT如何打开txt并把内容显示在textEdit中(有中文)

2024-11-29 10:18:19
推荐回答(1个)
回答1:

QFile file("xxxx.txt");

if(file.open(QIODevice::ReadOnly))

{

QTextStream read(&file);

while(!read.atEnd() )

{

tetedit->Append(read.readLine());

}

}

dbInfo.close();