QOpcUaElementOperand Class
OPC UA 的 ElementOperand 类型。更多内容...
| 头文件: | #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) |
| 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()。
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 中引入。
© 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.