SVG in QML-app for iOS



  • Dear Qt-Community,
    I just wrote an app in QML, using Qt-Creator 3.6 and Qt 5.6. I have imported svg (Qt += svg). All the images I have are SVG-files, so the whole Layout is resizable. To adapt the size of the svgs to render, I changed the sourceSize.height and sourceSize.width property. It works all fine in Windows, on Mac Desktop, on Android and on Windows RT.

    However, in iOS the svgs er never sharp, I always get a blurred image as if the svg was rendered to its original size and then scaled up or down. The image comes up - so the problem can't be that I didn't import the svg statements. It just has a horrible quality. I just tested inside virtual iPhones 6, 5 and 4s by Xcode. On iOS changing the sourceSize property doesn't seem to have any affect on the rendered size of the image. It looks exactly the same when I change the usual height and width property of the QML-image. I also tried to turn off and on antialiasing, smooth and mipmap, but it didn't make the svg's sharper either.

    Is that a bug? Or anything I have overseen?

    Thank you very much



  • A little off-topic. In my previous experience, svg icons occupied too much memory, so, I decided using png instead, just two years ago. If it's a good option now, it will be considered in my future projects.



  • I think then I need to use png-files instead. Even though that is exhausting - as the app works on other platforms. So I need to create png's just for iOS. But that's the way it goes...

    Thank you very much for helping me!

    If anyone has an idea on how to use the svg's I'll be happy to hear about it :).



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.