Before QML times we have QPainter api.
Now we have QQuickPaintedItem class, but according to documentation:
QQuickPaintedItem is meant to make it easier to port old code that is using the QPainter API to the QML Scene Graph API and it should be used only for that purpose.
So how to paint now? Let's say we want draw only lines and images.
The only thing that comes to my mind is next:
1) According to http://doc-snapshot.qt-project.org/qt5-stable/qtquick/scenegraph-customgeometry.html make the same class but for line [LClass].
2) Make class with QSGSimpleTextureNode to display image/texture[TClass].
3) Make class which will add LClass and TClass into self. In other words - draw. [DrawClass]
4) After drawing finished, make DrawClass layout.enabled:true;
And this is works.
BUT! It is painfully slow.
Because there is a hundreds of QQuickItem objects, which should be added and maintained by scenegraph and seems this have big overhead.
I made the test.
I modified, as I said, customgeometry example to draw a line. Add it with Rereater in qml 10000 times. Add animation - and it just dies.
Than I took https://qt-project.org/doc/qt-5.1/qtopengl/2dpainting.html example, disable native rendering. Make it draw lines, increased number of lines to 10000. And it still move smooth.
Of course if we will render this to frameBuffer this will add some overhead, but...
P.S. I even not talk about how hard to draw something in this way...
Please, take a look attachments.