[Qt-interest] How to compress QString

Thiago Macieira thiago.macieira at trolltech.com
Thu Apr 16 11:59:57 CEST 2009


Em Quinta-feira 16 Abril 2009, às 11:08:47, Oliver.Knoll at comit.ch escreveu:
> One flavour of qCompress takes an uchar * and the number of bytes as
> argument:
>
>   QByteArray qCompress (const uchar *data, int nbytes, int compressionLevel
> = -1)
>
> You get access to the raw unicode bytes within a QString with several
> methods:
>
>   http://doc.trolltech.com/4.5/qstring.html#data-2 (you get a QChar *)
>   http://doc.trolltech.com/4.5/qstring.html#utf16 (you get a ushort *)
>   http://doc.trolltech.com/4.5/qstring.html#unicode (you get a QChar *)

I would instead recommend you convert the string to UTF-8 before you compress 
it.

YMMV.
-- 
Thiago Macieira - thiago.macieira (AT) nokia.com
  Senior Product Manager - Nokia, Qt Software
     Sandakerveien 116, NO-0402 Oslo, Norway
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090416/ec5876eb/attachment.bin 


More information about the Qt-interest-old mailing list