qt_qml_singleton_type

将 QML 文件标记为提供单例类型。

该属性在 Qt 6.2 中引入。

提供单例类型的.qml 文件需要将其QT_QML_SINGLETON_TYPE source 属性设置为TRUE ,以确保单例命令被写入qmldir文件。除了包含pragma Singleton 语句的 QML 文件外,还必须这样做。源属性必须在创建单例所属模块之前设置。

有关如何设置QT_QML_SINGLETON_TYPE 属性的示例,请参阅qt_target_qml_sources()

另请参阅 qt_target_qml_sources

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