QTextStream writes wrong end line characters after readLine method was called at end of file.
After inspecting QTextStreamPrivate::fillReadBuffer:
Here texMode flag is changed in QIODevice:
// handle text translation and bypass the Text flag in the device.
bool textModeEnabled = device->isTextModeEnabled();
if (textModeEnabled)
device->setTextModeEnabled(false);
Here it is restored:
// reset the Text flag.
if (textModeEnabled)
device->setTextModeEnabled(true);
But it will never be restored if this condition is true:
if (bytesRead <= 0)
return false;