QOpcUaDataValue Class

该类存储 OPC UA 值数据和相关元数据。更多

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

公共函数

QOpcUaDataValue()
QOpcUaDataValue(const QOpcUaDataValue &other)
~QOpcUaDataValue()
(since 6.7) quint16 serverPicoseconds() const
QDateTime serverTimestamp() const
(since 6.7) void setServerPicoseconds(quint16 serverPicoseconds)
void setServerTimestamp(const QDateTime &serverTimestamp)
(since 6.7) void setSourcePicoseconds(quint16 sourcePicoseconds)
void setSourceTimestamp(const QDateTime &sourceTimestamp)
void setStatusCode(QOpcUa::UaStatusCode statusCode)
void setValue(const QVariant &value)
(since 6.7) quint16 sourcePicoseconds() const
QDateTime sourceTimestamp() const
QOpcUa::UaStatusCode statusCode() const
void swap(QOpcUaDataValue &other)
QVariant value() const
(since 6.7) QVariant operator QVariant() const
QOpcUaDataValue &operator=(const QOpcUaDataValue &other)
(since 6.7) bool operator!=(const QOpcUaDataValue &lhs, const QOpcUaDataValue &rhs)
(since 6.7) bool operator==(const QOpcUaDataValue &lhs, const QOpcUaDataValue &rhs)

详细描述

该类对应于 OPC UA DataValue 类型。

成员函数文档

QOpcUaDataValue::QOpcUaDataValue()

构造一个无效数据值。

QOpcUaDataValue::QOpcUaDataValue(const QOpcUaDataValue &other)

other 构建一个数据值。

[noexcept] QOpcUaDataValue::~QOpcUaDataValue()

销毁数据值。

[since 6.7] quint16 QOpcUaDataValue::serverPicoseconds() const

返回服务器时间戳的 10 皮秒间隔数。

此函数在 Qt 6.7 中引入。

另请参阅 setServerPicoseconds()。

QDateTime QOpcUaDataValue::serverTimestamp() const

返回value() 的服务器时间戳。

另请参阅 setServerTimestamp().

[since 6.7] void QOpcUaDataValue::setServerPicoseconds(quint16 serverPicoseconds)

将服务器时间戳的 10 皮秒间隔数设置为serverPicoseconds

此函数在 Qt 6.7 中引入。

另请参阅 serverPicoseconds() 。

void QOpcUaDataValue::setServerTimestamp(const QDateTime &serverTimestamp)

将服务器时间戳设置为serverTimestamp

另请参阅 serverTimestamp() 。

[since 6.7] void QOpcUaDataValue::setSourcePicoseconds(quint16 sourcePicoseconds)

将源时间戳的 10 皮秒间隔数设置为sourcePicoseconds

此函数在 Qt 6.7 中引入。

另请参阅 sourcePicoseconds() 。

void QOpcUaDataValue::setSourceTimestamp(const QDateTime &sourceTimestamp)

将源时间戳设置为sourceTimestamp

另请参阅 sourceTimestamp() 。

void QOpcUaDataValue::setStatusCode(QOpcUa::UaStatusCode statusCode)

将状态代码设为statusCode

另请参阅 statusCode() 。

void QOpcUaDataValue::setValue(const QVariant &value)

将值设置为value

如果该数据值要与QOpcUaBinaryDataEncodingQOpcUaGenericStructHandler 一起使用,则值的类型必须是QOpcUaVariant

另请参阅 value()。

[since 6.7] quint16 QOpcUaDataValue::sourcePicoseconds() const

返回源时间戳的 10 皮秒间隔数。

此函数在 Qt 6.7 中引入。

另请参阅 setSourcePicoseconds()。

QDateTime QOpcUaDataValue::sourceTimestamp() const

返回value() 的源时间戳。

另请参阅 setSourceTimestamp().

QOpcUa::UaStatusCode QOpcUaDataValue::statusCode() const

返回此数据值的状态代码。如果状态代码不是Good ,则数据值和时间戳无效。

另请参阅 setStatusCode()。

[noexcept] void QOpcUaDataValue::swap(QOpcUaDataValue &other)

将此数据值实例与other 互换。该函数运行速度非常快,从未出现过故障。

QVariant QOpcUaDataValue::value() const

返回值。

另请参见 setValue()。

[since 6.7] QVariant QOpcUaDataValue::operator QVariant() const

返回包含此数据值的QVariant

此函数在 Qt 6.7 中引入。

QOpcUaDataValue &QOpcUaDataValue::operator=(const QOpcUaDataValue &other)

在此数据值中设置other 的值。

相关非会员

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

如果lhs 不等于rhs ,则返回true

此函数在 Qt 6.7 中引入。

[noexcept, since 6.7] bool operator==(const QOpcUaDataValue &lhs, const QOpcUaDataValue &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.