QOpcUaVariant Class
La variante OPC UA. Más información...
| Encabezado: | #include <QOpcUaVariant> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS OpcUa) target_link_libraries(mytarget PRIVATE Qt6::OpcUa) |
| qmake: | QT += opcua |
| Desde: | Qt 6.7 |
Tipos públicos
| enum class | ValueType { Unknown, Boolean, SByte, Byte, Int16, …, DiagnosticInfo } |
Funciones públicas
| QOpcUaVariant() | |
| QOpcUaVariant(QOpcUaVariant::ValueType type, const QVariant &value) | |
| QOpcUaVariant(QOpcUaVariant::ValueType type, const QVariant &value, const QList<qint32> arrayDimensions) | |
| QOpcUaVariant(const QOpcUaVariant &other) | |
| QOpcUaVariant(QOpcUaVariant &&other) | |
| ~QOpcUaVariant() | |
| QList<qint32> | arrayDimensions() const |
| bool | isArray() const |
| void | setArrayDimensions(const QList<qint32> &arrayDimensions) |
| void | setValue(QOpcUaVariant::ValueType type, const QVariant &value) |
| void | setValue(QOpcUaVariant::ValueType type, const QVariant &value, const QList<qint32> &arrayDimensions) |
| void | swap(QOpcUaVariant &other) |
| QOpcUaVariant::ValueType | type() const |
| QVariant | value() const |
| operator QVariant() const | |
| QOpcUaVariant & | operator=(QOpcUaVariant &&other) |
| QOpcUaVariant & | operator=(const QOpcUaVariant &rhs) |
Elementos no miembros relacionados
| bool | operator!=(const QOpcUaVariant &lhs, const QOpcUaVariant &rhs) |
| bool | operator==(const QOpcUaVariant &lhs, const QOpcUaVariant &rhs) |
Descripción detallada
La variante OPC UA es una unión de todos los tipos OPC UA integrados y también contiene información sobre las dimensiones de la matriz asociadas al valor. Actualmente, esta clase solo es compatible con QOpcUaBinaryDataEncoding y QOpcUaGenericStructHandler.
Documentación de los tipos de miembro
enum class QOpcUaVariant::ValueType
Esta enumeración contiene los posibles tipos de valor de una variante de OPC UA.
| Constante | Valor | Descripción |
|---|---|---|
QOpcUaVariant::ValueType::Unknown | 0 | |
QOpcUaVariant::ValueType::Boolean | 1 | |
QOpcUaVariant::ValueType::SByte | 2 | |
QOpcUaVariant::ValueType::Byte | 3 | |
QOpcUaVariant::ValueType::Int16 | 4 | |
QOpcUaVariant::ValueType::UInt16 | 5 | |
QOpcUaVariant::ValueType::Int32 | 6 | |
QOpcUaVariant::ValueType::UInt32 | 7 | , |
QOpcUaVariant::ValueType::Int64 | 8 | |
QOpcUaVariant::ValueType::UInt64 | 9 | |
QOpcUaVariant::ValueType::Float | 10 | |
QOpcUaVariant::ValueType::Double | 11 | |
QOpcUaVariant::ValueType::String | 12 | |
QOpcUaVariant::ValueType::DateTime | 13 | |
QOpcUaVariant::ValueType::Guid | 14 | |
QOpcUaVariant::ValueType::ByteString | 15 | |
QOpcUaVariant::ValueType::XmlElement | 16 | |
QOpcUaVariant::ValueType::NodeId | 17 | |
QOpcUaVariant::ValueType::ExpandedNodeId | 18 | |
QOpcUaVariant::ValueType::StatusCode | 19 | |
QOpcUaVariant::ValueType::QualifiedName | 20 | |
QOpcUaVariant::ValueType::LocalizedText | 21 | |
QOpcUaVariant::ValueType::ExtensionObject | 22 | |
QOpcUaVariant::ValueType::DataValue | 23 | |
QOpcUaVariant::ValueType::Variant | 24 | |
QOpcUaVariant::ValueType::DiagnosticInfo | 25 |
Documentación de las funciones de los miembros
QOpcUaVariant::QOpcUaVariant()
«Default» crea una nueva variante de OPC UA.
QOpcUaVariant::QOpcUaVariant(QOpcUaVariant::ValueType type, const QVariant &value)
Crea una nueva variante OPC UA de tipo « type » con el valor « value ».
Los valores escalares deben pasarse como un « QVariant » que contenga el valor « type ». Los valores de matriz deben pasarse como un « QVariant » que contenga un « QList » de « type ».
QOpcUaVariant::QOpcUaVariant(QOpcUaVariant::ValueType type, const QVariant &value, const QList<qint32> arrayDimensions)
Crea una nueva variante OPC UA de tipo type con el valor value y las dimensiones de la matriz arrayDimensions.
Los valores escalares deben pasarse como un « QVariant » que contenga el valor « type ». Los valores de matriz deben pasarse como un « QVariant » que contenga un « QList » de « type ».
QOpcUaVariant::QOpcUaVariant(const QOpcUaVariant &other)
Crea una nueva variante de OPC UA a partir de other.
[constexpr noexcept default] QOpcUaVariant::QOpcUaVariant(QOpcUaVariant &&other)
Crea una nueva variante OPC UA a partir de other.
Nota: El objeto del que se ha realizado el traslado, other, queda en un estado parcialmente formado, en el que las únicas operaciones válidas son la destrucción y la asignación de un nuevo valor.
[noexcept] QOpcUaVariant::~QOpcUaVariant()
Elimina esta variante de OPC UA.
QList<qint32> QOpcUaVariant::arrayDimensions() const
Devuelve las dimensiones del array de esta variante de OPC UA.
Véase también setArrayDimensions().
bool QOpcUaVariant::isArray() const
Devuelve « true » si esta variante de OPC UA contiene un valor de matriz.
void QOpcUaVariant::setArrayDimensions(const QList<qint32> &arrayDimensions)
Establece las dimensiones de la matriz en arrayDimensions.
Véase también arrayDimensions().
void QOpcUaVariant::setValue(QOpcUaVariant::ValueType type, const QVariant &value)
Establece el valor de esta variante OPC UA en value y el tipo en type.
Los valores escalares deben pasarse como un ` QVariant ` que contenga un valor de tipo ` type`. Los valores de matriz deben pasarse como un ` QVariant ` que contenga un ` QList ` de tipo ` type`.
Véase también value().
void QOpcUaVariant::setValue(QOpcUaVariant::ValueType type, const QVariant &value, const QList<qint32> &arrayDimensions)
Establece el valor de esta variante OPC UA en value, el tipo en type y las dimensiones de la matriz en arrayDimensions.
Los valores escalares deben pasarse como un ` QVariant ` que contenga un valor de ` type`. Los valores de matriz deben pasarse como un ` QVariant ` que contenga un ` QList ` de ` type`.
[noexcept] void QOpcUaVariant::swap(QOpcUaVariant &other)
Intercambia el objeto de definición de enumeración other por este objeto de variante OPC UA. Esta operación es muy rápida y nunca falla.
QOpcUaVariant::ValueType QOpcUaVariant::type() const
Devuelve el tipo de valor de esta variante de OPC UA.
QVariant QOpcUaVariant::value() const
Devuelve el valor de esta variante de OPC UA.
Véase también setValue().
QOpcUaVariant::operator QVariant() const
Devuelve un objeto ` QVariant ` que contiene esta variante de OPC UA.
[noexcept] QOpcUaVariant &QOpcUaVariant::operator=(QOpcUaVariant &&other)
La operación «Move-assigns» asigna other a esta instancia de QOpcUaVariant.
Nota: El objeto del que se ha realizado el traslado, other, pasa a un estado parcialmente formado, en el que las únicas operaciones válidas son la destrucción y la asignación de un nuevo valor.
QOpcUaVariant &QOpcUaVariant::operator=(const QOpcUaVariant &rhs)
Establece los valores de rhs en esta variante de OPC UA.
Elementos relacionados no incluidos
[noexcept] bool operator!=(const QOpcUaVariant &lhs, const QOpcUaVariant &rhs)
Devuelve « true » si « lhs » no es igual a « rhs ».
[noexcept] bool operator==(const QOpcUaVariant &lhs, const QOpcUaVariant &rhs)
Devuelve « true » si « lhs » es igual a « rhs ».
© 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.