QWaylandBufferRef Class
QWaylandBufferRef 类保存了对表面缓冲区的引用。更多内容...
| 头文件: | #include <QWaylandBufferRef> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor) target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor) |
| qmake: | QT += waylandcompositor |
公共函数
| QWaylandBufferRef() | |
| QWaylandBufferRef(const QWaylandBufferRef &ref) | |
| ~QWaylandBufferRef() | |
| bool | hasBuffer() const |
| bool | hasContent() const |
(since 6.2) bool | hasProtectedContent() const |
| QImage | image() const |
| bool | isDestroyed() const |
| bool | isNull() const |
| bool | isSharedMemory() const |
| quintptr | lockNativeBuffer() |
| QWaylandSurface::Origin | origin() const |
| QSize | size() const |
| QOpenGLTexture * | toOpenGLTexture(int plane = 0) const |
| void | unlockNativeBuffer(quintptr handle) |
| struct wl_resource * | wl_buffer() const |
| QWaylandBufferRef & | operator=(const QWaylandBufferRef &ref) |
相关的非成员
| bool | operator!=(const QWaylandBufferRef &lhs, const QWaylandBufferRef &rhs) |
| bool | operator==(const QWaylandBufferRef &lhs, const QWaylandBufferRef &rhs) |
成员函数文档
QWaylandBufferRef::QWaylandBufferRef()
创建一个空缓冲区引用。
QWaylandBufferRef::QWaylandBufferRef(const QWaylandBufferRef &ref)
创建一个指向ref 所引用的缓冲区的新引用。
[noexcept] QWaylandBufferRef::~QWaylandBufferRef()
解除对缓冲区的引用。
bool QWaylandBufferRef::hasBuffer() const
如果该QWaylandBufferRef 引用了一个缓冲区,则返回true;否则返回false。
另请参阅 isNull() 和hasContent()。
bool QWaylandBufferRef::hasContent() const
如果该QWaylandBufferRef 引用的是一个包含内容的缓冲区,则返回true;否则返回false。
[since 6.2] bool QWaylandBufferRef::hasProtectedContent() const
如果该QWaylandBufferRef 引用的是包含受保护内容的缓冲区,则返回true;否则返回false。
注意:这是一个 启用功能,它假设客户端缓冲区集成支持该功能。目前 Qt 中包含的客户端缓冲区集成均不支持受保护内容缓冲区。
该函数在 Qt 6.2 中引入。
另请参阅 hasContent()。
QImage QWaylandBufferRef::image() const
返回一张包含缓冲区内容的图像。
bool QWaylandBufferRef::isDestroyed() const
如果该QWaylandBufferRef 引用的缓冲区已被销毁,则返回true;否则返回false。
bool QWaylandBufferRef::isNull() const
如果该QWaylandBufferRef 未引用缓冲区,则返回true;否则返回false。
另请参阅 hasBuffer() 和hasContent()。
bool QWaylandBufferRef::isSharedMemory() const
如果缓冲区是共享内存缓冲区,则返回 true;否则返回 false。
quintptr QWaylandBufferRef::lockNativeBuffer()
返回该缓冲区的本机句柄,并将其标记为已锁定,因此该句柄在调用unlockNativeBuffer()之前不会被释放。
如果该缓冲区没有本机句柄,或者锁定操作未成功,则返回 0。
QWaylandSurface::Origin QWaylandBufferRef::origin() const
返回缓冲区的原点。如果引用的缓冲区为空,则返回QWaylandSurface::OriginBottomLeft 。
QSize QWaylandBufferRef::size() const
返回缓冲区的大小。如果引用的缓冲区为空,则返回一个无效的 QSize()。
QOpenGLTexture *QWaylandBufferRef::toOpenGLTexture(int plane = 0) const
返回该缓冲区的 OpenGL 纹理。plane 是多平面格式(如 YUV)的索引。
返回的纹理由该缓冲区拥有。该纹理仅在缓冲区引用存在期间有效。本函数的调用方不得删除该纹理,并且在纹理被使用期间必须保留对该缓冲区的引用。
如果没有有效的缓冲区,或者无法创建纹理,则返回nullptr 。
void QWaylandBufferRef::unlockNativeBuffer(quintptr handle)
将本机缓冲区标记为不再使用。handle 必须与之前调用lockNativeBuffer()所返回的值相匹配。
struct wl_resource *QWaylandBufferRef::wl_buffer() const
返回该缓冲区的 Wayland 资源。
QWaylandBufferRef &QWaylandBufferRef::operator=(const QWaylandBufferRef &ref)
将ref 分配给此缓冲区,并添加对其的引用。此前引用的缓冲区将被解除引用。
相关的非成员
[noexcept] bool operator!=(const QWaylandBufferRef &lhs, const QWaylandBufferRef &rhs)
如果 `lhs ` 与 `rhs` 引用的是同一个缓冲区,则返回 `false `;否则返回 `true`。
[noexcept] bool operator==(const QWaylandBufferRef &lhs, const QWaylandBufferRef &rhs)
如果 `lhs ` 与 `rhs` 引用的是同一个缓冲区,则返回 `true `;否则返回 `false`。
© 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.