[SOLVED] How to get text of svgz file?
I need to add svgz(zipped svg) content to the QDomDocument.
Usual svg i can open with QFile & QTextStream.
Only way I find, is to extract it with gunzip. But then I must to use additional qprocess.
Is there any other way?
You can use QuaZIP. It's a wrapper for zlib.
There is a FAQ entry on compression and decompression.
I can't uncompress svgz with quazip or qzipreader.
I can uncompress only usual zip files.
Only way I find, is to rename svgz to gz.
You can start a QProcess using "gunzip -c", then feed the compressed svgz to the process' stdin (using QProcess::write!) and read the decompressed data from the process' stdout (using QProcess::read!). As QProcess is a QIODevice, you might try to attach a QTextStream to it for reading.
So, Qt can't read svgz.
I'll try to use method proposed by Volker.
It was easier than I thought:
At the output I get svg text.
Then I replace qDebug with it:
And my problem is solved!
Thanks Volker again.
You're welcome. You might try
Maybe that saves you from copying around some bytes in the QByteArray.
Thanks a lot. Again. :)
I didn't know about this method.
In Qt, many classes that deal with data have a constructor or method that uses a QIODevice pointer as data source. It's always worth a try to look for those.