QVector<T> already has an implementation for serialization to a QDataStream via non-menber functions operator>> and operator<<. Do you need to serialize to some different kind of stream?