QSurface 类是 Qt 中可渲染表面的抽象。 更多...
头: | #include <QSurface> |
CMake: |
find_package(Qt6 COMPONENTS Gui REQUIRED)
target_link_libraries(mytarget PRIVATE Qt6::Gui) |
qmake: | QT += gui |
Since: | Qt 5.0 |
继承者: | QOffscreenSurface and QWindow |
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 ) |
表面尺寸可访问采用 size () 函数。表面的渲染特定属性可访问透过 format () 函数。
SurfaceClass 枚举描述表面的实际子类。
常量 | 值 | 描述 |
---|---|---|
QSurface::Window
|
0
|
表面是实例化的 QWindow . |
QSurface::Offscreen
|
1
|
表面是实例化的 QOffscreenSurface . |
SurfaceType 枚举描述表面是什么类型。
常量 | 值 | 描述 |
---|---|---|
QSurface::RasterSurface
|
0
|
表面由像素组成,且可以使用软件光栅化器 (像 Qt 的光栅绘制引擎) 渲染。 |
QSurface::OpenGLSurface
|
1
|
表面是 OpenGL 兼容表面且可以用于结合 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 supported on macOS only. |
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 supported on Windows only. |
[protected]
QSurface::
QSurface
(
QSurface::SurfaceClass
type
)
创建表面,采用给定 type .
[virtual]
QSurface::
~QSurface
()
销毁此表面。
[pure virtual]
QSurfaceFormat
QSurface::
format
() const
返回表面的格式。
[pure virtual]
QSize
QSurface::
size
() const
返回表面大小 (以像素为单位)。
[since 5.3]
bool
QSurface::
supportsOpenGL
() const
返回 true 若表面兼容 OpenGL 且可以用于结合 QOpenGLContext ;否则返回 false。
该函数在 Qt 5.3 引入。
返回此表面的表面类。
[pure virtual]
QPlatformSurface
*QSurface::
surfaceHandle
() const
返回特定平台的表面实现句柄。
[pure virtual]
QSurface::SurfaceType
QSurface::
surfaceType
() const
返回表面的类型。