QSurface 类

QSurface 类是 Qt 中可渲染表面的抽象。 更多...

头: #include <QSurface>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
继承者:

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 () 函数。

成员类型文档编制

enum QSurface:: SurfaceClass

SurfaceClass 枚举描述表面的实际子类。

常量 描述
QSurface::Window 0 表面是实例化的 QWindow .
QSurface::Offscreen 1 表面是实例化的 QOffscreenSurface .

enum QSurface:: SurfaceType

SurfaceType 枚举描述表面是什么类型。

常量 描述
QSurface::RasterSurface 0 The surface is composed of pixels and can be rendered to using a software rasterizer like Qt's raster paint engine.
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 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.

成员函数文档编制

[explicit protected] QSurface:: QSurface ( QSurface::SurfaceClass type )

创建表面,采用给定 type .

[virtual noexcept] QSurface:: ~QSurface ()

销毁此表面。

[pure virtual] QSurfaceFormat QSurface:: format () const

返回表面的格式。

[pure virtual] QSize QSurface:: size () const

返回表面大小 (以像素为单位)。

bool QSurface:: supportsOpenGL () const

返回 true 若表面兼容 OpenGL 且可以用于结合 QOpenGLContext ;否则返回 false。

QSurface::SurfaceClass QSurface:: surfaceClass () const

返回此表面的表面类。

[pure virtual] QPlatformSurface *QSurface:: surfaceHandle () const

返回特定平台的表面实现句柄。

[pure virtual] QSurface::SurfaceType QSurface:: surfaceType () const

返回表面的类型。