Change element in SVG
-
Hello,
I need refresh data in svg element - for example time in time box.To do this, i wrote C++ class with interface that change data in svg (in xml file) and this class have Q_PROPERTY (QString svgData).
In QML I have this image:Image { source: 'data:image/svg+xml;utf8,'+svgFile.svgData }This work, but when svgData is changed image is refresh with blank glitch image (So image is generate right but It seems that re-render image first erase old data and than write new data).
My question Is what is best way to change some text (defined by id) in svg?
-
Hello,
I need refresh data in svg element - for example time in time box.To do this, i wrote C++ class with interface that change data in svg (in xml file) and this class have Q_PROPERTY (QString svgData).
In QML I have this image:Image { source: 'data:image/svg+xml;utf8,'+svgFile.svgData }This work, but when svgData is changed image is refresh with blank glitch image (So image is generate right but It seems that re-render image first erase old data and than write new data).
My question Is what is best way to change some text (defined by id) in svg?
@poucz said in Change element in SVG:
what is best way to change some text (defined by id) in svg?
Unfortunately, Qt does not have proper support for dynamically updating individual elements of an SVG file. As you have discovered, you need to reload the whole SVG image if you change an element.
-
Hello,
I need refresh data in svg element - for example time in time box.To do this, i wrote C++ class with interface that change data in svg (in xml file) and this class have Q_PROPERTY (QString svgData).
In QML I have this image:Image { source: 'data:image/svg+xml;utf8,'+svgFile.svgData }This work, but when svgData is changed image is refresh with blank glitch image (So image is generate right but It seems that re-render image first erase old data and than write new data).
My question Is what is best way to change some text (defined by id) in svg?
@poucz said in Change element in SVG:
So image is generate right
Did you verify that? Maybe the SVG is invalid after your modification?
-
Hello,
I need refresh data in svg element - for example time in time box.To do this, i wrote C++ class with interface that change data in svg (in xml file) and this class have Q_PROPERTY (QString svgData).
In QML I have this image:Image { source: 'data:image/svg+xml;utf8,'+svgFile.svgData }This work, but when svgData is changed image is refresh with blank glitch image (So image is generate right but It seems that re-render image first erase old data and than write new data).
My question Is what is best way to change some text (defined by id) in svg?
@poucz said in Change element in SVG:
what is best way to change some text (defined by id) in svg?
Unfortunately, Qt does not have proper support for dynamically updating individual elements of an SVG file. As you have discovered, you need to reload the whole SVG image if you change an element.
-
@poucz said in Change element in SVG:
what is best way to change some text (defined by id) in svg?
Unfortunately, Qt does not have proper support for dynamically updating individual elements of an SVG file. As you have discovered, you need to reload the whole SVG image if you change an element.
-
P poucz has marked this topic as solved on