Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Render web content offscreen using QtWebEngine

I am trying to port an application that uses QtWebKit to render web content over to one that uses QtWebEngine.

I am limited what I can change architecturally so I have to stick with the current approach of rendering the page, capturing to a memory buffer and then moving that across to a different process where the buffer is used as a texture in OpenGL.

I've tried porting the code over (broadly speaking) by replacing WebKit with WebEngine, but the APIs are different.

Can anyone tell me if this is possible? If so, please point me in the right direction to illustrates how to hook everything up.

like image 271
speedwell Avatar asked Oct 19 '22 14:10

speedwell


1 Answers

Yes, the APIs are different, and the code path used for rendering uses the scene graph (yes, even for the widgets-based API).

So in this case it is not a WebEngine-specific problem but rather a problem of how to get pixels out of a Qt Quick scene. This is what QQuickRenderControl, which was introduced in Qt 5.4 is trying to address.

QtWebEngine might have some additional quirks related to visibility when doing offscreen stuff in 5.4, hopefully fixed in 5.5 though.

This is definitely a use case that is not demonstrated by QtWebEngine examples, but contributions are welcome.

like image 78
elproxy Avatar answered Nov 15 '22 11:11

elproxy