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.
You forgot to include <QTextStream>
or <QFile>
.
I added
#include <QTextStream>
#include <QFile>
#include <QDataStream>
and it worked for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With