QOpcUaElementOperand Class

OPC UA 元素操作符类型。更多

头文件: #include <QOpcUaElementOperand>
CMake: find_package(Qt6 REQUIRED COMPONENTS OpcUa)
target_link_libraries(mytarget PRIVATE Qt6::OpcUa)
qmake: QT += opcua

公共函数

QOpcUaElementOperand()
QOpcUaElementOperand(quint32 index)
QOpcUaElementOperand(const QOpcUaElementOperand &rhs)
quint32 index() const
void setIndex(quint32 index)
QVariant operator QVariant() const
QOpcUaElementOperand &operator=(const QOpcUaElementOperand &rhs)
(since 6.7) bool operator!=(const QOpcUaElementOperand &lhs, const QOpcUaElementOperand &rhs)
(since 6.7) bool operator==(const QOpcUaElementOperand &lhs, const QOpcUaElementOperand &rhs)

详细说明

ElementOperand 定义于 OPC UA 1.05 第 4 部分 7.7.4.2。它通过索引(第一个元素的索引为 0)来识别过滤器中的另一个元素。

创建复杂过滤器时需要使用该索引,例如在((Severity > 500)AND(Message == "TestString"))中引用 AND 运算的两个操作数。第一步是为两个条件(Severity > 500)和(Message == "TestString")创建内容过滤元素。需要第三个内容过滤元素来创建两个条件的 AND 组合。它由 AND 运算符和两个元素操作数组成,其中两个元素操作数是之前创建的两个条件的索引:

QOpcUaMonitoringParameters::EventFilter filter;
...
// setup select clauses
...
QOpcUaContentFilterElement condition1;
QOpcUaContentFilterElement condition2;
QOpcUaContentFilterElement condition3;
condition1 << QOpcUaContentFilterElement::FilterOperator::GreaterThan << QOpcUaSimpleAttributeOperand("Severity") <<
                QOpcUaLiteralOperand(quint16(500), QOpcUa::Types::UInt16);
condition2 << QOpcUaContentFilterElement::FilterOperator::Equals << QOpcUaSimpleAttributeOperand("Message") <<
                QOpcUaLiteralOperand("TestString", QOpcUa::Types::String);
condition3 << QOpcUaContentFilterElement::FilterOperator::And << QOpcUaElementOperand(0) << QOpcUaElementOperand(1);
filter << condition1 << condition2 << condition3;

成员函数文档

QOpcUaElementOperand::QOpcUaElementOperand()

默认构造一个不带参数的元素操作数。

QOpcUaElementOperand::QOpcUaElementOperand(quint32 index)

构建索引为index 的元素操作数。

QOpcUaElementOperand::QOpcUaElementOperand(const QOpcUaElementOperand &rhs)

rhs 中构造一个元素操作数。

quint32 QOpcUaElementOperand::index() const

返回将用作操作数的过滤元素的索引。

另请参见 setIndex()。

void QOpcUaElementOperand::setIndex(quint32 index)

将用作操作数的过滤元素的索引设置为index

另请参阅 index() 。

QVariant QOpcUaElementOperand::operator QVariant() const

将此元素操作数转换为QVariant

QOpcUaElementOperand &QOpcUaElementOperand::operator=(const QOpcUaElementOperand &rhs)

在此元素操作数中设置rhs 的值。

相关非成员

[noexcept, since 6.7] bool operator!=(const QOpcUaElementOperand &lhs, const QOpcUaElementOperand &rhs)

如果lhs 的值与rhs 不同,则返回true

此函数在 Qt 6.7 中引入。

[noexcept, since 6.7] bool operator==(const QOpcUaElementOperand &lhs, const QOpcUaElementOperand &rhs)

如果lhs 的值与rhs 相同,则返回true

此函数在 Qt 6.7 中引入。

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