QWaylandSurfaceGrabber Class

QWaylandSurfaceGrabber class allows to read the content of a QWaylandSurface 更多...

头: #include <QWaylandSurfaceGrabber>
qmake: QT += waylandcompositor
Since: Qt 5.8
继承: QObject

公共类型

enum Error { InvalidSurface, NoBufferAttached, UnknownBufferType, RendererNotReady }

公共函数

QWaylandSurfaceGrabber (QWaylandSurface * surface , QObject * parent = Q_NULLPTR)
void grab ()
QWaylandSurface * surface () const

信号

void failed (Error error )
void success (const QImage & image )

额外继承成员

详细描述

QWaylandSurfaceGrabber class allows to read the content of a QWaylandSurface

Sometimes it is needed to get the contents of a surface, for example to provide a screenshot to the user. The QWaylandSurfaceGrabber class provides a simple method to do so, without having to care what type of buffer backs the surface, be it shared memory, OpenGL or something else.

成员类型文档编制

enum QWaylandSurfaceGrabber:: Error

The Error enum describes the reason for a grab failure.

常量 描述
QWaylandSurfaceGrabber::InvalidSurface 0 The surface is null or otherwise not valid.
QWaylandSurfaceGrabber::NoBufferAttached 1 The client has not attached a buffer on the surface yet.
QWaylandSurfaceGrabber::UnknownBufferType 2 The buffer attached on the surface is of an unknown type.
QWaylandSurfaceGrabber::RendererNotReady 3 The compositor renderer is not ready to grab the surface content.

成员函数文档编制

QWaylandSurfaceGrabber:: QWaylandSurfaceGrabber ( QWaylandSurface * surface , QObject * parent = Q_NULLPTR)

创建 QWaylandSurfaceGrabber 对象采用给定 surface and parent

[signal] void QWaylandSurfaceGrabber:: failed ( Error error )

void QWaylandSurfaceGrabber:: grab ()

Grab the content of the surface set on this object. It may not be possible to do that immediately so the success and failed signals should be used to be notified of when the grab is completed.

[signal] void QWaylandSurfaceGrabber:: success (const QImage & image )

QWaylandSurface *QWaylandSurfaceGrabber:: surface () const

Returns the surface set on this object