You are not logged in.

Dear visitor, welcome to If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.




Tuesday, January 18th 2005, 4:34pm

qCompress - how to use?

I don't know how to exactly use the qCompress()-function. i everytime get returned just an empty bytearray.

QString to_compress = "abcdefgh";
QByteArray byte_array;
QTextStream tstream(byte_array, IO_WriteOnly);
tstream << to_compress;
QString compressed = QString(qCompress(, byte_array.size()));

but the "compressed"-string is everytime just empty... what's wrong? maybe i must've linked some 3rd party lib (zlib?) ??

  • "wysota" is male

Posts: 4,276

Location: Warsaw, POLAND

  • Send private message


Tuesday, January 18th 2005, 6:00pm

RE: qCompress - how to use?

You can't compress it to QString! QString holds text strings and qCompress returns hexadecimal data. You can store it in QCString if you have to or direct it through QDataStream to some object that can accept it (like a QFile).