QML SVG files displayed incorrectly
-
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?
-
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 ?
-
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 ?
-
please, check 'here' (link) in original post...
-
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
-
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...