本页内容

EventFilter QML Type

为受监控项定义一个 EventFilter。更多...

Import Statement: import QtOpcUa
Since: QtOpcUa 5.13
Status: Deprecated since 6.9

自 QtOpcUa 6.9 起,此类型已弃用。我们强烈建议不要在新代码中使用它。

属性

  • select : list<SimpleAttributeOperand>
  • where : list<FilterElement>

详细说明

要监控服务器上的事件,需要一个事件过滤器。它由select 子句和where 子句组成。

select 子句用于指定在发生事件时用户希望接收的数据。它由SimpleAttributeOperand 简单属性操作数组成,这些操作数用于选择事件类型的子节点的属性,例如BaseEventType的“Message”属性的value属性。

where 子句用于通过匹配特定条件来限制报告的事件。多种运算符和四种不同的操作数类型允许根据事件类型的子节点的属性值进行过滤。

select子句由一组SimpleAttributeOperand 组成。where子句由一组SimpleAttributeOperand 、LiteralOperand 、ElementOperand 或AttributeOperand 组成。

以下 EventFilter 指示服务器报告“Message”字段的值,条件是“Severity”字段的值 >= 500:

import QtOpcUa as QtOpcUa
QtOpcUa.Node {
    ...

    eventFilter: QtOpcUa.EventFilter {
        select: [
                  QtOpcUa.SimpleAttributeOperand {
                    browsePath: [
                                  QtOpcUa.NodeId {
                                      identifier: "Severity"
                                      ns: "http://opcfoundation.org/UA/"
                                  }
                                ]
                  },
                  QtOpcUa.SimpleAttributeOperand {
                    browsePath: [
                                  QtOpcUa.NodeId {
                                      identifier: "Message"
                                      ns: "http://opcfoundation.org/UA/"
                                  }
                                ]
                  }
        ]

        where: [
            QtOpcUa.FilterElement {
                operator: QtOpcUa.FilterElement.GreaterThanOrEqual
                firstOperand: QtOpcUa.SimpleAttributeOperand {
                    browsePath: [
                                  QtOpcUa.NodeId {
                                      identifier: "Severity"
                                      ns: "http://opcfoundation.org/UA/"
                                  }
                                ]
                }
                secondOperand: QtOpcUa.LiteralOperand {
                                value: 700
                                type: QtOpcUa.Constants.UInt16
                 }
            }
        ]
    }
}

有关包含两个条件的更复杂示例,请参阅QOpcUaElementOperand 。

另请参阅 FilterElement 。

属性文档

select : list<SimpleAttributeOperand>

在报告新事件时应包含的选定事件字段。

where : list<FilterElement>

用于将报告的事件限制为符合特定条件的事件的内容过滤器。

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