Originally Qt Quick always relied on OpenGL (OpenGL ES 2.0 or OpenGL 2.0) for parsing the scene graph and rendering the results to a render target. From Qt 5.8 onwards Qt Quick also supports rendering in software and with Direct3D 12.
The default rendering backend is still OpenGL, or - in Qt builds with disabled OpenGL support - the software renderer. This can be overridden either by using an environment variable or a C++ API. The former consists of setting the
QT_QUICK_BACKEND
or the legacy
QMLSCENE_DEVICE
environment variable before launching applications. The latter is done by calling
QQuickWindow::setSceneGraphBackend
() early in the application's main() function.
The supported backends are the following
""
or the enum value
QSGRendererInterface::OpenGL
.
"software"
or the enum value
QSGRendererInterface::Software
.
"d3d12"
or the enum value
QSGRendererInterface::Direct3D12
.
"openvg"
or the enum value
QSGRendererInterface::OpenVG
.
When in doubt which backend is in use, enable basic scenegraph information logging via the
QSG_INFO
environment variable or the
qt.scenegraph.general
logging category. This will result in printing some information during application startup onto the debug output.
注意: Adaptations other than OpenGL will typically come with a set of limitations since they are unlikely to provide a feature set 100% compatible with OpenGL. However, they may provide their own specific advantages in certain areas. Refer to the sections below for more information on the various adaptations.
The default adaptation capable of providing the full Qt Quick 2 feature set is the OpenGL adaptation. All of the details of the OpenGL adaptation can are available here: OpenGL Adaptation
The Software adaptation is an alternative renderer for Qt Quick 2 that uses the raster paint engine to render the contents of the scene graph. The details for this adaptation are available here: Software Adaptation
The Direct3D 12 adaptation is an alternative renderer for Qt Quick 2 when running on Windows 10, both for Win32 and UWP applications. The details for this adaptation are available here: Direct3D 12 Adaptation
The OpenVG adaptation is an alternative renderer for Qt Quick 2 that will renderer the contents of the scene graph using OpenVG commands to provide hardware-acclerated 2D vector and raster graphics. The details for this adaptation are available here: OpenVG Adaptation