QSurface Class

The QSurface class is an abstraction of renderable surfaces in Qt. 更多...

头文件: #include <QSurface>
qmake: QT += gui
开始支持版本: Qt 5.0
派生类:

QOffscreenSurface and QWindow

公有类型

enum SurfaceClass { Window, Offscreen }
enum SurfaceType { RasterSurface, OpenGLSurface, RasterGLSurface, OpenVGSurface }

公有函数

virtual ~QSurface()
virtual QSurfaceFormat format() const = 0
virtual QSize size() const = 0
bool supportsOpenGL() const
SurfaceClass surfaceClass() const
virtual QPlatformSurface *surfaceHandle() const = 0
virtual SurfaceType surfaceType() const = 0

受保护的函数

QSurface(SurfaceClass type)

详细描述

The QSurface class is an abstraction of renderable surfaces in Qt.

The size of the surface is accessible with the size() function. The rendering specific attributes of the surface are accessible through the format() function.

成员类型

enum QSurface::SurfaceClass

The SurfaceClass enum describes the actual subclass of the surface.

ConstantValueDescription
QSurface::Window0The surface is an instance of QWindow.
QSurface::Offscreen1The surface is an instance of QOffscreenSurface.

enum QSurface::SurfaceType

The SurfaceType enum describes what type of surface this is.

ConstantValueDescription
QSurface::RasterSurface0The surface is is composed of pixels and can be rendered to using a software rasterizer like Qt's raster paint engine.
QSurface::OpenGLSurface1The surface is an OpenGL compatible surface and can be used in conjunction with QOpenGLContext.
QSurface::RasterGLSurface2The 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::OpenVGSurface3The surface is an OpenVG compatible surface and can be used in conjunction with OpenVG contexts.

成员函数

[protected] QSurface::QSurface(SurfaceClass type)

Creates a surface with the given type.

[virtual] QSurface::~QSurface()

Destroys the surface.

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

Returns the format of the surface.

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

Returns the size of the surface in pixels.

bool QSurface::supportsOpenGL() const

Returns 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.

SurfaceClass QSurface::surfaceClass() const

Returns the surface class of this surface.

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

Returns a handle to the platform-specific implementation of the surface.

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

Returns the type of the surface.