QML SVG files displayed incorrectly
-
wrote on 23 Jan 2017, 21:20 last edited by
Having problem with displaying SVG files properly. Files are displayed ok in Firefox, Chrome, even in IE, but in QML Image I see only black contures...
More details here
Item { property alias source : originalImage.source Image { id: originalImage anchors.fill: parent sourceSize.width: parent.width sourceSize.height: parent.height antialiasing: true } }
Any workaround idea?
-
wrote on 24 Jan 2017, 18:43 last edited by
It seems I've found some workaround: if I replace <style> with <style type="text/css"> in SVG file, images are displayed correctly...
See e.g. extraGrenade-OK.svg attached to original bug report
-
Try with simple program like this. Just see if it works.
Rectangle {
visible: true
width: 640
height: 480Image { source : Qt.resolvedUrl("file:///Users/dheeru/Downloads/Mozilla_Firefox.svg") }
}
This code works perfectly. Which OS and Qt version ?
-
wrote on 24 Jan 2017, 09:44 last edited by
the problem is not what QML code displays SVG files (my example is ok) but how images displayed for certain SVG files. see referenced bug report for problematic files.
most probably svglib does not support (properly) some svg features...
-
which SVG file r u trying to load ? Do you have sample to check ?
-
wrote on 24 Jan 2017, 10:18 last edited by
please, check 'here' (link) in original post...
-
wrote on 24 Jan 2017, 18:43 last edited by
It seems I've found some workaround: if I replace <style> with <style type="text/css"> in SVG file, images are displayed correctly...
See e.g. extraGrenade-OK.svg attached to original bug report
-
wrote on 25 Jan 2017, 07:53 last edited by
Here it is - according to standard: "If a ‘type’ is not provided, the value of ‘contentStyleType’ on the ‘svg’ element shall be used, which in turn defaults to "text/css" [RFC2046]."
It seems, default value handling of style element in SVG images is not correct...
4/7