You can render QWebEngineView as follows:

QSize size=page()->contentsSize().toSize();
int w=size.width();
int h=size.height();
image=new QImage(w,h, QImage::Format_ARGB32);
painter = new QPainter(image);
render(painter);
image->save(filename);

But this only renders the widget to the image, not the whole web page. If the size of the widget is smaller than the whole web page, some of the web page is not shown on the widget, thus not rendered to the image. How to render the whole web page to the image?