mardi 21 avril 2015

Using QWebEngine to render an image

I'm looking to replace QWebKit with QWebEngine in my headless renderer. I initialise the page with load() and connect a slot to loadFinished() to generate the final .PNG image. This used to work fine with WebKit but fails with QWebEngine.

Code is as follows...

_webView = new QWebEngineView();

....

// Render the HTML to an image
QPainter painter(&image);
_webView->page()->view()->render(&painter);
painter.end();

I receive the following errors :

"Asking for share context for widget that does not have a window handle" "QOpenGLWidget: Cannot be used without a context shared with the toplevel".

Does anyone have an example of rendering a screen using QWebEngine?

Thanks.

Aucun commentaire:

Enregistrer un commentaire