![]() |
QCefView 1.0.7
A QWidget-based WebView Component Integrated with CEF
|
CEF supports native child window mode and OSR mode, in QCefView both modes are implemented.
When using NCW mode, CEF handles the creation and management of a separate native window for the browser. QCefView then obtains a handle to this window and embeds it within a Qt widget. This allows the browser content to be displayed as part of the Qt application's user interface.
When using OSR mode, CEF renders the web page content into a buffer (either in CPU memory or as a shared texture in GPU memory). QCefView then takes this buffer and displays it within a Qt widget. This gives you more control over how the web content is rendered and integrated into your application.
To enable OSR mode in QCefView, you need to configure it using QCefConfig
By setting config.setWindowlessRenderingEnabled(true)
, you instruct QCefView to use OSR (Off-Screen Rendering) mode. This configuration must be set before the QCefView instance is created.
QCefConfig::setWindowlessRenderingEnabled
to true
or false
, all QCefView instances in your application will use the same rendering mode.With OSR mode enabled, you can choose to use hardware acceleration.
When hardware acceleration is enabled, CEF renders the browser content to a shared texture in the GPU. QCefView then uses device-dependent technologies (DirectX, Metal, or OpenGL) to render the browser content to the user. This typically results in significantly better performance, especially for complex web content and animations.
When hardware acceleration is disabled, CEF provides a CPU memory buffer containing image color data to QCefView. QCefView then renders this buffer using Qt's software rasterizer. This mode can be useful in environments where hardware acceleration is not available or is causing issues.
To control hardware acceleration, you can use the following settings in QCefSetting
:
By default, CEF attempts to use hardware acceleration if it is available. However, explicitly setting the setHardwareAcceleration
provides more control.