Efficient off-screen rendering of QPainterPaths (both OpenGL and non-OpenGL solution required)
===

In my application, I paint a street map using QPainter on a widget. This is done by painting a lot of QPainterPaths, which contain the precalculated paths to be drawn (some of them filled). The widget is currently a QWidget, not a QGLWidget, but this might change.

I'm trying to move the painting off-screen and split it into chunked jobs. I want to paint each chunk onto a QImage and finally draw all images onto the widget. For this, the QPainterPaths are already chunked, so this is not the problem. The problem is, that drawing on QImages is about **5 times slower** than drawing on QWidget (in the paintEvent).

Is there a good way to efficiently draw the chunks off-screen? **Is there an off-screen counter part of QGLWidget (an OpenGL off-screen buffer) which can be used as a paint device for QPainter?**

Remember that my source are QPainterPaths (and line width + color; some of the paths need to be *drawn*, some *filled*), so I don't need all the other types of drawing QPainter supports. If QPainterPaths can be converted to something else which can be drawn on a OpenGL buffer, this would be a good solution. However, I'm not familiar with OpenGL off-screen rendering and I know that there are different types of OpenGL buffers, of which most of them aren't for 2D image rendering but for vertex data.

Can you please guide me in the right direction?

It would be nice if you can tell me a **non-OpenGL-based solution**, too, as I want to compile my application in two versions: OpenGL and non-OpenGL version.

Also, I want the solution to be able to render in a **non-GUI thread**.