QWaylandShellSurfaceTemplate Class
template <typename T> class QWaylandShellSurfaceTemplateQWaylandShellSurfaceTemplate 是一个用于创建自定义 Shell 表面类的便捷类。更多内容...
| 头文件: | #include <QWaylandShellSurfaceTemplate> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor) target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor) |
| qmake: | QT += waylandcompositor |
| 继承自: | QWaylandShellSurface |
| 继承自: | QWaylandIviSurface、QWaylandWlShellSurface 以及QWaylandXdgSurface |
静态公共成员
| T * | findIn(QWaylandObject *container) |
详细描述
QWaylandShellSurfaceTemplate 是一个从QWaylandShellSurface 继承的模板类,用于方便构建自定义 shell 扩展。
它基于扩展协议的 XML 描述,在Qt Wayland Compositor 与由qtwaylandscanner 生成的类之间建立了连接。
它提供了两项具体的便利功能:
- 对 `QWaylandCompositorExtension::extensionInterface()` 的重写实现,该方法返回由 `qtwaylandscanner` 生成的基类的 `
wl_interface` 指针。 - 一个静态函数findIn(),用于在给定的容器中搜索该扩展的实例,若找到则返回该实例。
其使用模式与 `QWaylandCompositorExtensionTemplate` 相同,其中 `T ` 即为子类本身。
另请参阅 “自定义 Shell”。
成员函数文档
[static] T *QWaylandShellSurfaceTemplate::findIn(QWaylandObject *container)
如果该接口的任何实例已注册到container 中,则返回该实例;否则返回null。查找操作基于生成的interfaceName() ,该文件与协议描述中的接口名称相匹配。
© 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.