The QSurface class is an abstraction of renderable surfaces in Qt. More...
Header: | #include <QSurface> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Gui) target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
Since: | Qt 5.0 |
Inherited By: |
enum | SurfaceClass { Window, Offscreen } |
enum | SurfaceType { RasterSurface, OpenGLSurface, RasterGLSurface, OpenVGSurface, VulkanSurface, …, Direct3DSurface } |
virtual | ~QSurface() |
virtual QSurfaceFormat | format() const = 0 |
virtual QSize | size() const = 0 |
bool | supportsOpenGL() const |
QSurface::SurfaceClass | surfaceClass() const |
virtual QPlatformSurface * | surfaceHandle() const = 0 |
virtual QSurface::SurfaceType | surfaceType() const = 0 |
QSurface(QSurface::SurfaceClass type) |
The size of the surface is accessible with the size() function. The rendering specific attributes of the surface are accessible through the format() function.
The SurfaceClass enum describes the actual subclass of the surface.
Constant | Value | Description |
---|---|---|
QSurface::Window |
0 |
The surface is an instance of QWindow. |
QSurface::Offscreen |
1 |
The surface is an instance of QOffscreenSurface. |
The SurfaceType enum describes what type of surface this is.
Constant | Value | Description |
---|---|---|
QSurface::RasterSurface |
0 |
The surface is is composed of pixels and can be rendered to using a software rasterizer like Qt's raster paint engine. |
QSurface::OpenGLSurface |
1 |
The surface is an OpenGL compatible surface and can be used in conjunction with QOpenGLContext. |
QSurface::RasterGLSurface |
2 |
The surface can be rendered to using a software rasterizer, and also supports OpenGL. This surface type is intended for internal Qt use, and requires the use of private API. |
QSurface::OpenVGSurface |
3 |
The surface is an OpenVG compatible surface and can be used in conjunction with OpenVG contexts. |
QSurface::VulkanSurface |
4 |
The surface is a Vulkan compatible surface and can be used in conjunction with the Vulkan graphics API. |
QSurface::MetalSurface |
5 |
The surface is a Metal compatible surface and can be used in conjunction with Apple's Metal graphics API. This surface type is only supported on macOS and iOS. |
QSurface::Direct3DSurface |
6 |
The surface is a Direct 3D 11 and 12 compatible surface and can be used in conjunction with the DXGI and Direct3D APIs. This surface type is only supported on Windows. |
[protected]
QSurface::QSurface(QSurface::SurfaceClass type)Creates a surface with the given type.
[virtual]
QSurface::~QSurface()Destroys the surface.
[pure virtual]
QSurfaceFormat QSurface::format() constReturns the format of the surface.
[pure virtual]
QSize QSurface::size() constReturns the size of the surface in pixels.
[since 5.3]
bool QSurface::supportsOpenGL() constReturns true if the surface is OpenGL compatible and can be used in conjunction with QOpenGLContext; otherwise returns false.
This function was introduced in Qt 5.3.
Returns the surface class of this surface.
[pure virtual]
QPlatformSurface *QSurface::surfaceHandle() constReturns a handle to the platform-specific implementation of the surface.
[pure virtual]
QSurface::SurfaceType QSurface::surfaceType() constReturns the type of the surface.