Incorrect CSS handling in Qt Svg module?



  • Hi,

    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 { fill: #ff0000; }
    @

    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! Can someone clarify this to me ... is the Qt code of parsing the CSS correct?



  • Added a bug report for this "here":http://bugreports.qt.nokia.com/browse/QTBUG-14001



  • QtSvgRenderer also fails to load the CSS if the SVG uses relative path to the CSS.

    Have logged a bug "here":http://bugreports.qt.nokia.com/browse/QTBUG-14043


Log in to reply
 

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