<QWaylandQuickExtension> - Qt Wayland Compositor Qt Quick Extension Macro Declarations

<QWaylandQuickExtension> 头文件包含用于创建Qt Quick 类型的宏,这些类型与QWaylandCompositorExtensionQWaylandObject 的子类相对应。更多

Header: #include <QWaylandQuickExtension>

详细说明

如果您要创建Qt Wayland Compositor 的扩展,QWaylandQuickExtension 头文件中的宏可能是手动实现每个类所需部分的有效替代方法。

另请参阅 自定义外壳

宏文档

Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS(className)

这个宏可以用来定义一个基于 Wayland 扩展的Qt Quick 类。它定义了一个继承自className 并以 "QuickExtension "为后缀的新类。

该类应是QWaylandCompositorExtension 的子类,并将自动调用QWaylandCompositorExtension::initialize() 。必须使用qmlRegisterType() 在Qt Quick 中手动注册该类型。

另请参见 Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT

Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CONTAINER_CLASS(className)

该宏可用于定义Qt Quick 类,该类旨在包含 Wayland 扩展。它

它定义了一个新类,该类继承自className ,名称后缀为 "QuickExtensionContainer"。className 提供的类应从QWaylandObject 继承,新类将有一个extensions 属性,通过调用基类中的addExtension() 和removeExtension() 来管理扩展。

必须使用qmlRegisterType() 在Qt Quick 中手动注册该类型。

[since 6.8] Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_NAMED_ELEMENT(className, QmlType)

这个宏可以用来定义一个基于 Wayland 扩展的Qt Quick 类。它定义了一个继承自className 的新类,名称后缀为 "QuickExtension"。

该宏的作用与Q_COMPOSITOR_DECLARE_QUICK_EXTENSION_CLASS 相同,但也会在当前 QML 模块中自动将新类型注册为QmlType

该宏在 Qt 6.8 中引入。

© 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.