Render web content offscreen using QtWebEngine

泪湿孤枕 提交于 2019-12-22 09:07:21

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/29547460/render-web-content-offscreen-using-qtwebengine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!