Regarding using QFile::readAll
Is it a good idea to read the complete file using QFile::readAll and store in QString variable.
It heavily depends on your use case, the size of the file, the amount of memory available - and probably many other parameters. But in general it is perfectly legitimate to read files as a whole.
Yes, it can be a good idea to read a whole file using QFile::readAll().
No, it can be a bad idea to read a whole file using QFile::readAll().
Which kind of question is that? It's not a matter of one-size-fits-all rules. If it makes sense for you (esp. regarding the memory allocation of such a thing) then do it. Just remember to properly decode the bytes of the file.