Canvas - alternative ?
-
Hi,
at the moment I am using Canvas an moveTo() / lineTo() to draw a kind of line diagram with incoming values.
Unfortunately the repaint interval of Canvas seems to be too slow.
In the code repaint() is called, when necessary. But it takes some time (> 300ms) until the repaint is really done.
Because of that I am searching for an alternative to Canvas to draw the lines.
What would you recommend? -
NOT a recommendation, but a suggestion; Path ( see glossary on page; i.e PathLine ) or perhaps Shape QML;
Path ~ https://doc.qt.io/qt-5/qml-qtquick-path.html
LineShape ~ https://doc.qt.io/qt-5/qml-qtquick-particles-lineshape.html
Shape ~ https://doc.qt.io/qt-5/qml-qtquick-shapes-shape.html
-
I used some shape stuff to replace my canvas code. I used Instantiators for some ShapePaths inside of Shape. I also used Repeaters for some Shapes and PolyMultiLine for some more complex paths inside those. I was doing mostly line drawing. Just be aware some of these objects are Item based and some are QObject based. I have no idea how fast it was compared to my original Canvas code. But it ended up being less complex and I made it all data driven via ListModel and js arrays.
How many lines are we talking?