Reputation: 127
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.
Upvotes: 11
Views: 23824
Reputation: 31
I added
#include <QTextStream>
#include <QFile>
#include <QDataStream>
and it worked for me.
Upvotes: 3