GraphicsView: Optimize painting to the actual update region
-
I am displaying live data in the form of curves (polylines) on terribly weak embedded hardware. The curves run from left to right, then the whole display is scrolled about 1/4 of it's width and I get some room to continue drawing.
Therefore, most of the time I only append a few points and would only need to paint those few points.However, the paint() event is required to be able to redraw the whole GraphicsItem, so I have to draw the whole polyline every time paint gets called - even if the actual update region is only a few pixels wide.
How can I determine the actual update region within the paint event, so I can - depending on what's needed - repaint everything or just the part that needs to be redrawn?