QWaylandSurfaceGrabber Class
QWaylandSurfaceGrabber 类可用于读取QWaylandSurface 的内容。更多内容...
| 头文件: | #include <QWaylandSurfaceGrabber> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor) target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor) |
| qmake: | QT += waylandcompositor |
| 继承自: | QObject |
公共类型
| enum | Error { InvalidSurface, NoBufferAttached, UnknownBufferType, RendererNotReady } |
公共函数
| QWaylandSurfaceGrabber(QWaylandSurface *surface, QObject *parent = nullptr) | |
| void | grab() |
| QWaylandSurface * | surface() const |
详细说明
有时需要获取一个表面的内容,例如向用户提供屏幕截图。QWaylandSurfaceGrabber 类提供了一种简单的方法来实现这一点,而无需关心表面背后使用的缓冲区类型,无论是共享内存、OpenGL 还是其他类型。
成员类型文档
enum QWaylandSurfaceGrabber::Error
Error 枚举描述了抓取失败的原因。
| 常量 | 值 | 描述 |
|---|---|---|
QWaylandSurfaceGrabber::InvalidSurface | 0 | 表面为 null 或无效。 |
QWaylandSurfaceGrabber::NoBufferAttached | 1 | 客户端尚未在表面上附加缓冲区。 |
QWaylandSurfaceGrabber::UnknownBufferType | 2 | 附加在表面上的缓冲区类型未知。 |
QWaylandSurfaceGrabber::RendererNotReady | 3 | 合成器渲染器尚未准备好抓取该表面内容。 |
成员函数文档
[explicit] QWaylandSurfaceGrabber::QWaylandSurfaceGrabber(QWaylandSurface *surface, QObject *parent = nullptr)
使用给定的surface 和parent
void QWaylandSurfaceGrabber::grab()
获取该对象上表面集的内容。由于可能无法立即完成此操作,因此应使用“成功”和“失败”信号来通知抓取操作何时完成。
QWaylandSurface *QWaylandSurfaceGrabber::surface() const
返回此对象上设置的曲面集
© 2026 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.