SVG: Fill color and mouseover

  • Hello,

    I would like to have SVG icons in my application so they look nice when scaled on higher DPI. Also I want to support custom themes without the need to create the icons in different colors.

    So I was trying around with QSvgWidget.
    I would change the fill color by loading the widget from a QByteArray and doing a replace("fill:#000000", "fill:#FF0000"); on it first for example.
    For a hover effect, I would create two widgets in different colors and then replace them if events occur.

    But I wonder if there isn't an easier way to do all this?
    I was not able to get a onmouseover="setAttribute('fill'..." working with a QSvgWidget, so I think it's not supported.

    I'm happy about any idea!

    Thank you very much!

  • @qtacc32 said in SVG: Fill color and mouseover:


    Nothing about this?

  • Qt Champions 2017

    As far as i know there is no better way than to parse and handle
    the svg yourself. maybe parse once, create hover pixmap version and use that.

Log in to reply

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