Render to a QGLFrameBuffer object and then use QGLFrameBuffer::toImage() to convert the result to an image.