Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Qt SVG : Dynamic Modification
-
Hi,
I need to modify the property of different elements of a SVG file dynamically based on some conditions.
Please note, it is not the entire SVG file that need to be modified. It should be able to access different elements of the svg file and to change the property of the elements . For example, if an svg file is amde of 5 rectangle elements, it should be able to change the color of the individual rectangles based on some dynamic conditions.Is this supported and doable in Qt . Please provide a solution.
-
@Parvathy2020 SVG is based on XML, so you can use https://doc.qt.io/qt-5/qtxml-index.html
-
@jsulm Is there any in built QT library that supports the dynamic modification of property of xml element in SVG file ?
-
@Parvathy2020 The link I posted before is Qt documentation for XML support. There is nothing special in Qt to modify SVG as far as I know, but as I said SVG is XML.
-
@jsulm Yes , SVG is made of xml elements. But how to edit the svg file dynamically -> parse the xml element -> update the property-> save the change- > display the updated svg image ??
Is there any code reference ?
-
@Parvathy2020 Did you read the documentation from the link I provided?!
If you need examples here you go: https://doc.qt.io/qt-5/examples-xml.html
-
@jsulm Ok thanks