使用QtWebEngine在屏幕外渲染Web内容 [英] Render web content offscreen using QtWebEngine

查看:645
本文介绍了使用QtWebEngine在屏幕外渲染Web内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将使用QtWebKit来呈现Web内容的应用程序移植到使用QtWebEngine的应用程序上.

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

我在架构上所做的更改受到限制,因此我必须坚持当前的方法,即渲染页面,捕获到内存缓冲区,然后将其移至另一个过程中,在OpenGL中将缓冲区用作纹理.

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.

我已经尝试通过用WebEngine替换WebKit来(从广义上来说)移植代码,但是API是不同的.

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.

推荐答案

是的,API是不同的,用于渲染的代码路径使用了场景图(是的,即使是基于小部件的API).

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

因此,在这种情况下,这不是WebEngine特定的问题,而是如何从Qt Quick场景中获取像素的问题.这就是Qt 5.4中引入的 QQuickRenderControl 所尝试的地址.

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 5.4

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

这肯定是一个用例, QtWebEngine 示例并未演示,但是欢迎您提供帮助.

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

这篇关于使用QtWebEngine在屏幕外渲染Web内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆