When reading from a QDataStream
it expects the data to be in a certain format, as described at http://qt-project.org/doc/qt-5.0/qtcore/datastreamformat.html. In the case of streaming QBitArray
this is:
The array size (quint32) The array bits, i.e. (size + 7)/8 bytes
If this is not the case the operation will fail - you can check QDataStream::status()
to detect errors.