You call readAll() in your if() conditions. That reads all data from the file.
Assuming there was data, you enter the else part of your code, which then calls readAll() again.
Since the file is at the end already, the result is an empty byte array.
Better use QFile::size() to check if the file is not empty.
And you don't need to specify QIODevice::Text when opening, you are not interpreting the content in any way.
Cheers,
_
Bookmarks