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

SVG (scalable vector graphic) rendering [solved]



  • Hello,

    I would like to display an SVG image that I created in visio. I can open it in IE, gimp and inkscape successfully, but when I try to display it in my Qt program, I get a very strange rendering. I tried saving the file using inkscape, but it was the same problem.

    This is my source code:
    @ QLabel* graphic = new QLabel();
    QIcon svgImage(":/Resources/visio.svg");

    graphic->setPixmap(svgImage.pixmap(1000,1000));@
    

    "Here is a link to the displayed SVG":http://imgur.com/DVLIQ7s

    Does anyone have any suggestions on how to fix this? Thanks! I don't need to use a QLabel, and I can even use a different image format (but preferably one that makes it easy to maintain text legibility).

    Thanks!

    Solution: Instead of opening the svg created by visio and resaving, I copied the Visio objects and pasted them into a new file in inkscape. I saved them as an (inkscape SVG). This svg format worked.


  • Lifetime Qt Champion

    Hi,

    IIRC, you'll need to use Qt's SVG module to do that. It might be too limited depending on which version of SVG you are using.



  • [quote author="SGaist" date="1389042714"]Hi,

    IIRC, you'll need to use Qt's SVG module to do that. It might be too limited depending on which version of SVG you are using.[/quote]

    Thanks! I use the module successfully for graphics I made in GIMP, but unfortunately the visio image does not render as expected. I suspect you are correct that it might be too limited.


  • Lifetime Qt Champion

    IIRC QtSvg supports the static features of SVG tiny 1.2


Log in to reply