// 用文件流来读取QFile file("my.txt");file.open(QIODevice::ReadOnly);QTextStram out(&file);while (!out.atEnd()) { // 每次读取一行,然后判断即可 QString strReadLine = out.readLine();}