QWaylandCompositorExtensionTemplate Class
template <typename T> class QWaylandCompositorExtensionTemplateQWaylandCompositorExtensionTemplate 是一个用于子类化QWaylandCompositorExtension 的便利类。更多
Header: | #include <QWaylandCompositorExtensionTemplate> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS WaylandCompositor) target_link_libraries(mytarget PRIVATE Qt6::WaylandCompositor) |
qmake: | QT += waylandcompositor |
继承: | QWaylandCompositorExtension |
继承者: | QWaylandIdleInhibitManagerV1,QWaylandIviApplication,QWaylandPresentationTime,QWaylandQtTextInputMethodManager,QWaylandTextInputManager,QWaylandViewporter,QWaylandXdgDecorationManagerV1, 以及QWaylandXdgOutputManagerV1 |
静态公共成员
T * | findIn(QWaylandObject *container) |
详细描述
QWaylandCompositorExtensionTemplate 是一个模板类,它继承于QWaylandCompositorExtension ,便于使用 Qt XML 构建自定义的 Wayland 扩展。
它根据扩展协议的 XML 描述,提供Qt Wayland Compositor 与由qtwaylandscanner
生成的类之间的连接。
它提供了两个特定的便利功能:
- 对QWaylandCompositorExtension::extensionInterface() 的重新实现,可返回 qtwaylandscanner 生成的基类的
wl_interface
指针。 - 静态findIn() 函数,在提供的容器中搜索扩展的实例,如果找到则返回。
通常情况下,新扩展将双重继承 QWaylandCompositorExtensionTemplate 和由qtwaylandscanner
生成的类。
QWaylandCompositorExtensionTemplate 应使用子类本身作为参数:
class MyExtension : public QWaylandCompositorExtensionTemplate<MyExtension> , QtWaylandServer::my_extension
在本例中,MyExtension
是生成的接口my_extension
的实现。
另请参阅 自定义外壳。
成员函数文档
[static]
T *QWaylandCompositorExtensionTemplate::findIn(QWaylandObject *container)
如果接口的任何实例已在container 注册,则返回该实例。否则将返回空值。查询基于生成的interfaceName()
,该 与协议描述中的接口名称相匹配。
© 2025 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.