QAbstractExtensionFactory Class
QAbstractExtensionFactory 类为Qt Widgets Designer 中的扩展工厂提供了一个接口。更多
头文件: | #include <QAbstractExtensionFactory> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Designer) target_link_libraries(mytarget PRIVATE Qt6::Designer) |
qmake: | QT += designer |
继承于 |
公共函数
virtual | ~QAbstractExtensionFactory() |
virtual QObject * | extension(QObject *object, const QString &iid) const = 0 |
详细说明
QAbstractExtensionFactory 不打算被直接实例化;请使用QExtensionFactory 代替。
在Qt Widgets Designer 中,扩展工厂用于查找和创建所需的命名扩展。因此,在实现自定义扩展时,您还必须创建一个QExtensionFactory ,即一个能够为您的扩展创建实例的类,并使用Qt Widgets Designer 的extension manager 进行注册。
当需要扩展时,Qt Widgets Designer 的extension manager 会遍历所有已注册的工厂,每个工厂都会调用QExtensionFactory::createExtension() ,直到找到第一个能为选定对象创建所需扩展的工厂。然后,该工厂将创建一个扩展实例。
另请参阅 QExtensionFactory 和QExtensionManager 。
© 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.