You seem to expect a text file format. Shouldn't you be using QTextStream instead?

Regardless of whether you use a QDataStream or a QTextStream, you need not load everything in a QByteArray. You can read from any QIODevice, including a QFile. Just remember to call status() to detect failures.