[Interest] Loading compressed SVG in QWebView

Yves Bailly yves.bailly at sescoi.fr
Thu May 31 09:00:48 CEST 2012

Greetings all,

Here's an annoying problem I'm facing, trying to display an SVG image
in a QWebView. If the image is compressed ("*.svgz"), it seems QWebView
is unable to display it correctly.

To be more precise, this works nicely:

QByteArray image_data = /* some external source I know nothing about */
QWebView* my_web_view = /* ... */
my_web_view->setContent(image_data, "image/svg+xml", source_url);

...but if the "image_data" contains a compressed SVG, e.g. read from an "*.svgz"
file, then an error is displayed.

Browsing around I could not find a "nice" solution, unless to try to uncompress
the data myself... Maybe the MIME type I provide is not correct?

Any hint appreciated :-)

      /- Yves Bailly - Software developper  -\
      \- Sescoi R&D  - http://www.sescoi.fr -/
"The possible is done. The impossible is being done. For miracles,
thanks to allow a little delay."

More information about the Interest mailing list