[Qt-embedded-interest] How to display a QImage which is in Hex format

Sujit Kumar sujitk at pivotsys.com
Wed Oct 14 13:03:57 CEST 2009


Hi Trinath
    Use QByteArray *fromHex <qbytearray.html#fromHex>* ( const 
QByteArray & /hexEncoded/ )

QByteArray readCompressed = QByteArray:: fromHex (rStr.toAscii ()); 
if (readCompressed! = compressed) 
qDebug ( "bytes before hexing and dehexing _is_ different."); 
QByteArray readDecompressed = qUncompress (readCompressed); 
if (readDecompressed! = ba) 
qDebug ( "bytes before and after compressions are different."); 
QImage readImg; 
/ / QBuffer readBuf (& readDecompressed); 
readImg.loadFromData (readDecompressed); 
if (readImg.isNull ()) 
qDebug ( "The image is null. Something failed."); 
readImg.save ( "test.bmp");

Thanks,
Sujit


trinathpujari wrote:
> Hi All.
>
>        I want to display a QImage from a buffer which is in *Hex *format,
>        So how can i display the image on the screen.
>        Do anybody have any idea please tell me...
>
> Cheers
>   Trinath
>
>
>
> _______________________________________________
> Qt-embedded-interest mailing list
> Qt-embedded-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-embedded-interest
>
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-embedded-interest/attachments/20091014/ac6bb0d8/attachment.html 


More information about the Qt-embedded-interest mailing list