Active Qt
Qt 对 ActiveX 和 COM 的支持使 Windows 平台的 Qt 开发人员能够:
- 在其 Qt 应用程序中访问和使用任何 ActiveX 服务器提供的 ActiveX 控件和 COM 对象。
- 将 Qt 应用程序作为 COM 服务器提供,并将任意数量的 Qt 对象和控件作为 COM 对象和 ActiveX 控件使用。
有关在 Qt 中使用 ActiveX 的更多信息,请参阅《在 Qt 中构建 ActiveX 服务器》。
ActiveQt 框架由两个模块组成:
- QAxContainer模块是一个静态库,它实现了QObject 的子类QAxObject 以及QWidget 的子类QAxWidget ,它们作为 COM 对象和 ActiveX 控件的容器。
- QAxServer模块是一个静态库,实现了进程内和可执行 COM 服务器的功能。该模块提供了QAxAggregated 、QAxBindable 和QAxFactory 类。
还提供了一套工具,用于简化使用 ActiveX 的 Qt 项目的开发和构建。
使用该模块
要使用 Qt 模块的 C++ API,需要将项目链接到该模块的库,既可以直接链接,也可以通过其他依赖项间接链接。包括CMake和qmake 在内的多种构建工具都对此提供了专门的支持。
使用 CMake 进行构建
使用find_package() 命令在Qt6 包中定位所需的模块组件:
find_package(Qt6 REQUIRED COMPONENTS AxContainer AxServer)
target_link_libraries(mytarget PRIVATE Qt6::AxContainer Qt6::AxServer)更多详细信息,请参阅《使用 CMake 构建》概述。
使用 qmake 进行构建
要配置模块以便使用 qmake 进行构建,请在项目的 .pro 文件中将该模块作为QT 变量的值添加:
QT += axcontainer axserver文章与指南
示例
参考资料
许可与归属
QAxContainer 和QAxServer 模块由The Qt Company 提供,采用商业许可。此外,它们还采用BSD 3 条款“新”或“修订”许可。
更多详细信息请参阅Qt 许可条款。
© 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.