I'm very new to C++ in general, and to Qt as well, thus I have a question:
I've got this code:
if(!logFile.open(QIODevice::ReadOnly)) {
QMessageBox::information(0, "error", logFile.errorString());
}
else {
QTextStream result(&logFile);
return result.readAll();
}
It is running fine. However, when I try to return the QTextStream object instead of QString w/ all the text I've read from file, following error pops up:
/home/neko/projects/WurmLogparser/wurmlog.cpp:208: error: call to deleted constructor of 'QTextStream'
return result;
^~~~~~
code what is causing error seen below:
else {
QTextStream result(&logFile);
return result;
//return result.readAll();
}
Of course, I'm changing the related types to QTextStream appropriatelly before trying to compile second version. Please, tell me what is the problem with 2nd version of code? I construct QTextStream the same way as in the first part, but it produces strange error for me.