[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?
-
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.
And then:
@gunzip vector.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.
Thanks. -
It was easier than I thought:
@QProcess proc(this);
QStringList args;
args<<"-c"<<"../vector.svgz";
proc.start("gunzip",args);
proc.waitForFinished();
qDebug()<<proc.readAll();@
At the output I get svg text.
Then I replace qDebug with it:
@QDomDocument dom;
dom.setContent(proc.readAll());@
And my problem is solved!
Thanks Volker again. -
Thanks a lot. Again. :)
I didn't know about this method.