Solved Render a Quick Item to a png
-
Hi,
I have a Quick Application, where I made my own QML Item for a bar chart (using a repeater for the boxes, axis labels and ticks). I would like to save this to a png file, is this possible?
-
Hi
Something like wont work ?
https://doc.qt.io/qt-5/qml-qtquick-item.html#grabToImage-method -
Thanks! This is exactly what I was looking for and it works!
Just out of curiosity, is there an easy way to render a QuickItem to a SVG?
-
Hi
Super :)
Frankly, i have never tried it.
But if you own Item is made with QPainter commands then something like they do here
https://doc.qt.io/qt-5/qtsvg-svggenerator-example.html
(on the c++ side) -
Yes, unfortunately I don't use QPainter.
-
@maxwell31
Im not sure its really possible then as however, you draw it must be converted to
SVG instructions and unless you can draw on QSvgGenerator then its a no go, i think.