Important: Please read the Qt Code of Conduct -

Selective layer rendering of an svg file with a QGraphicsSvgItem

  • I have an svg file with multiple layers that I wish to toggle on/off in a Qt app.
    Following the black_joker/red_joker example in the Qt documentation I created an QGraphicsSvgItem for each layer, gave it a shared renderer with QSvgRenderer, and assigned it the correct layer Id.
    Unfortunately when adding the QGraphicsSvgItem to the scene, the original transformation from the svg seems lost; all layers are drawn around the origin.

    Is there any way to keep the original transformation (translation)? Or is there any other way to achieve the effect of selective layer toggling?

Log in to reply