Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QSvgRenderer incorrectly renders "Inkscape" SVG files



  • Greetings!

    I have an app which loads SVG files using QGraphicsView/Scene + QGraphicsSvgItem + QSvgRenderer. My app seems working with basic SVG files but when I load an "Inkscape" SVG file (with multiple items/shapes within it), it incorrectly renders them (there are black regions which are supposedly be "texts" and shapes/etc are not found in the right place). I am using Inkscape to create SVG files. I tried to use IE to check if the files are corrupted but it renders them correctly. I also used the SVG files in the "Inkscape tutorial" with NO success.

    Is this a bug in the QSvgRenderer? are there any other alternatives?

    Thanks and more powers!



  • Are you converting these to an image

    this is not related but it might help a little bit

    http://stackoverflow.com/questions/8551690/qt-how-to-render-scaled-svg-to-qimage


  • Moderators

    QtSvg module uses SVGtiny specification only, it does not support full SVG standard, and is known to have numerous bugs.

    Current recommendation is to use QtWebKit for rendering non-trival SVG files.



  • Thanks sierdzio. That could be the problem with QSvgRenderer.

    Are there any alternatives? third party maybe? or any links on how i can modify QSvgRenderer (I learned that the devs deprecated the library)?


  • Moderators

    QtWebKit. There sure are other renderers, but I don't know them. Check inkscape, it probably uses some GTK stuff.


Log in to reply