最近使用SVG画了一张地图,想放在QSvgWidget中显示,但是有很多元素却显示不出来,自己找了很长时间原因,最终确定问题出在polyline元素的stroke属性上,SVG文件如下:
<svg width="240" height="320" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="map" transform="translate(120,160),scale(0.2)">
<defs>
<g id="road">
<polyline id="l1" points="178,391 191,391 203,394"/>
</g>
</defs>
<use xlink:href="#road" style="fill:none;stroke:black;stroke-width:12"/>
<use xlink:href="#road" style="fill:none;stroke:yellow;stroke-width:11"/>
</g>
</svg>
在其他的SVG浏览器中都可正常显示,但是在QSvgWidget控件中无论怎么修改stroke属性,都无法显示,难道是qt对SVG支持的问题?还请各位多多帮忙!