QWaylandSurfaceGrabber Class

The QWaylandSurfaceGrabber class allows to read the content of a QWaylandSurface More...

Header: #include <QWaylandSurfaceGrabber>
qmake: QT += waylandcompositor
Inherits: QObject

This class is under development and is subject to change.

Public Types

enum Error { InvalidSurface, NoBufferAttached, UnknownBufferType, RendererNotReady }

Public Functions

QWaylandSurfaceGrabber(QWaylandSurface *surface, QObject *parent = Q_NULLPTR)
void grab()
QWaylandSurface *surface() const
  • 31 public functions inherited from QObject


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

Additional Inherited Members

  • 1 property inherited from QObject
  • 1 public slot inherited from QObject
  • 11 static public members inherited from QObject
  • 9 protected functions inherited from QObject

Detailed Description

The 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 SHM, OpenGL or something else.

Member Type Documentation

enum QWaylandSurfaceGrabber::Error

The Error enum describes the reason for a grab failure.

QWaylandSurfaceGrabber::InvalidSurface0The surface is null or otherwise not valid.
QWaylandSurfaceGrabber::NoBufferAttached1The client has not attached a buffer on the surface yet.
QWaylandSurfaceGrabber::UnknownBufferType2The buffer attached on the surface is of an unknown type.
QWaylandSurfaceGrabber::RendererNotReady3The compositor renderer is not ready to grab the surface content.

Member Function Documentation

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

Create a QWaylandSurfaceGrabber object with the given 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

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.