Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Incorrect CSS handling in Qt Svg module?

Incorrect CSS handling in Qt Svg module?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 0 Posters 3.7k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • ? This user is from outside of this forum
    ? This user is from outside of this forum
    Guest
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • ? This user is from outside of this forum
      ? This user is from outside of this forum
      Guest
      wrote on last edited by
      #2

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

      1 Reply Last reply
      0
      • ? This user is from outside of this forum
        ? This user is from outside of this forum
        Guest
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved