Qt OPC UA

The Qt OPC UA module implements a Qt API to interact with OPC UA on top of a 3rd party OPC UA stack.

The stacks are integrated as plugins and can be selected at runtime. Currently, the following implementations are supported:

  • Open62541 v1.3.6, MPLv2
  • Unified Automation C++ SDK (UACpp), Commercial

The QML API is still in development but are available as a technology preview. This means those parts are unstable, likely to change, and provided as a convenience only.

使用模块

QML API

The QML 类型 are available through the QtOpcUa 导入。要使用类型,添加以下 import 语句到 .qml 文件:

import QtOpcUa as QtOpcUa
					

C++ API

使用 C++ API 要求直接或透过其它依赖链接到模块库。一些构建工具对此提供专用支持,包括 CMake 和 qmake。

构建采用 CMake

使用 find_package() 命令以在 Qt6 包中定位所需的模块组件:

find_package(Qt6 REQUIRED COMPONENTS OpcUa)
target_link_libraries(mytarget Qt::OpcUa)
					

采用 qmake 构建

要配置采用 qmake 构建模块,把模块作为 Qt 变量的值添加到工程 .pro 文件中:

QT += opcua
					

文章和指南

范例

参考