Details
-
Bug
-
Resolution: Incomplete
-
P3: Somewhat important
-
None
-
4.7.0
-
None
-
Win XP SP3
Description
I have a SVG which uses a CSS file. I find if some SVG style attributes are split between CSS and SVG, the QSvgRenderer does not handle it correctly.
Take this SVG element
<rect width="50" height="30" fill-opacity="0.5" class="myfill">
and the CSS that defines the fill attribute is
.myfill
So, I should get a 0.5 opacity red rectangle in my SVG. This works fine in various browsers like Chrome and Firefox, but when I use Qt SVG module to render this, it does not work properly.
I ran through the code and find that the switch case for handling CSS elements searches for the starting letter of the element and the whole logic is based on that. So when fill and fill-opacity are split between the SVG and CSS, this does not work. But if I have both fill and fill-opacity in the same place (either both in the SVG or both in the CSS), then the Qt SVG renderer shows the rectangle correctly! I think this approach of parsing the CSS is not the best way to do it.