Note: If you want to use this function to uncompress external data that was compressed using zlib, you first need to prepend a four byte header to the byte array containing the data. The header must contain the expected length (in bytes) of the uncompressed data, expressed as an unsigned, big-endian, 32-bit integer.
QFile file("./zlib_file.dat");
if(!file.open(QIODevice::ReadOnly)){
return;
}
QByteArray data = file.readAll();
QByteArray head(4,0);
head[3] = 255;
data.insert(0,head);
QByteArray deflate = qUncompress(data);