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

<QWaylandQuickExtension> 头文件包含用于创建Qt Quick 类型的宏,这些类型对应于QWaylandCompositorExtension 和QWaylandObject 的子类。更多内容...

Header: #include <QWaylandQuickExtension>

宏

详细说明

如果您正在为Qt Wayland Compositor 创建扩展,QWaylandQuickExtension头文件中的宏可能是一个有用的替代方案,可免去为每个类手动实现所需部分的麻烦。

另请参阅 “自定义 Shell”。

宏文档

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)

该宏可用于定义一个旨在包含 Wayland 扩展的 `Qt Quick ` 类。

它定义了一个继承自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` 相同,但还会自动将新类型作为 `QmlType ` 注册到当前的 QML 模块中。

该宏于 Qt 6.8 中引入。

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