Qt中的c++错误:有初始化但不完整的类型。

时间:2021-11-08 14:04:38
void FindWords::getTextFile() {
    QFile myFile(":/FindingWords2.txt");
    myFile.open(QIODevice::ReadOnly);

    QTextStream textStream(&myFile);
    QString line = textStream.readAll();
    myFile.close();

    ui->textEdit->setPlainText(line);
    QTextCursor textCursor = ui->textEdit->textCursor();
    textCursor.movePosition(QTextCursor::Start, QTextCursor::MoveAnchor, 1);
}

The QTextStream textStream(&myFile) keeps giving me the error and I can't fix it.

QTextStream textStream(&myFile)一直给我错误,我无法修复它。

1 个解决方案

#1


16  

You forgot to include <QTextStream> or <QFile>.

您忘记包含

#1


16  

You forgot to include <QTextStream> or <QFile>.

您忘记包含