diff options
author | Martin Klos <martin.klos@basyskom.com> | 2021-01-04 10:14:37 +0100 |
---|---|---|
committer | Martin Klos <martin.klos@basyskom.com> | 2021-01-07 11:05:54 +0100 |
commit | 5d04d949a4abd9ee3c8e7c56af644df796f4d5f4 (patch) | |
tree | b1fdbd7fcd5cb06e63642b0c06e5dd6554dedf82 /src | |
parent | ad125da77b809156849f7cc2d22b0b52f341f4fb (diff) |
Refactor deprecated QVariant usage in source
Change-Id: I2ef3f9a124a0e090ab9437002e61e3778d51af76
Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/opcua/client/qopcuaclientprivate.cpp | 2 | ||||
-rw-r--r-- | src/plugins/opcua/open62541/qopen62541subscription.cpp | 10 | ||||
-rw-r--r-- | src/plugins/opcua/open62541/qopen62541valueconverter.cpp | 12 |
3 files changed, 12 insertions, 12 deletions
diff --git a/src/opcua/client/qopcuaclientprivate.cpp b/src/opcua/client/qopcuaclientprivate.cpp index 4044f45..bb86ee3 100644 --- a/src/opcua/client/qopcuaclientprivate.cpp +++ b/src/opcua/client/qopcuaclientprivate.cpp @@ -219,7 +219,7 @@ void QOpcUaClientPrivate::namespaceArrayUpdated(QOpcUa::NodeAttributes attr) const QVariant value = m_namespaceArrayNode->attribute(QOpcUa::NodeAttribute::Value); - if (!(attr & QOpcUa::NodeAttribute::Value) || value.type() != QVariant::Type::List) { + if (!(attr & QOpcUa::NodeAttribute::Value) || value.metaType().id() != QMetaType::QVariantList) { m_namespaceArray.clear(); emit q->namespaceArrayUpdated(QStringList()); return; diff --git a/src/plugins/opcua/open62541/qopen62541subscription.cpp b/src/plugins/opcua/open62541/qopen62541subscription.cpp index c1966c0..630f78f 100644 --- a/src/plugins/opcua/open62541/qopen62541subscription.cpp +++ b/src/plugins/opcua/open62541/qopen62541subscription.cpp @@ -170,7 +170,7 @@ void QOpen62541Subscription::modifyMonitoring(quint64 handle, QOpcUa::NodeAttrib // SetPublishingMode service if (item == QOpcUaMonitoringParameters::Parameter::PublishingEnabled) { - if (value.type() != QVariant::Bool) { + if (value.metaType().id() != QMetaType::Bool) { qCWarning(QT_OPCUA_PLUGINS_OPEN62541) << "New value for PublishingEnabled is not a boolean"; p.setStatusCode(QOpcUa::UaStatusCode::BadTypeMismatch); emit m_backend->monitoringStatusChanged(handle, attr, item, p); @@ -205,7 +205,7 @@ void QOpen62541Subscription::modifyMonitoring(quint64 handle, QOpcUa::NodeAttrib // SetMonitoringMode service if (item == QOpcUaMonitoringParameters::Parameter::MonitoringMode) { - if (value.type() != QVariant::UserType || value.userType() != QMetaType::fromType<QOpcUaMonitoringParameters::MonitoringMode>().id()) { + if (value.userType() != QMetaType::fromType<QOpcUaMonitoringParameters::MonitoringMode>().id()) { qCWarning(QT_OPCUA_PLUGINS_OPEN62541) << "New value for MonitoringMode is not a monitoring mode"; p.setStatusCode(QOpcUa::UaStatusCode::BadTypeMismatch); emit m_backend->monitoringStatusChanged(handle, attr, item, p); @@ -752,7 +752,7 @@ bool QOpen62541Subscription::modifyMonitoredItemParameters(quint64 nodeHandle, Q switch (item) { case QOpcUaMonitoringParameters::Parameter::DiscardOldest: { - if (value.type() != QVariant::Bool) { + if (value.metaType().id() != QMetaType::Bool) { qCWarning(QT_OPCUA_PLUGINS_OPEN62541) << "Could not modify DiscardOldest, value is not a bool"; p.setStatusCode(QOpcUa::UaStatusCode::BadTypeMismatch); emit m_backend->monitoringStatusChanged(nodeHandle, attr, item, p); @@ -762,7 +762,7 @@ bool QOpen62541Subscription::modifyMonitoredItemParameters(quint64 nodeHandle, Q break; } case QOpcUaMonitoringParameters::Parameter::QueueSize: { - if (value.type() != QVariant::UInt) { + if (value.metaType().id() != QMetaType::UInt) { qCWarning(QT_OPCUA_PLUGINS_OPEN62541) << "Could not modify QueueSize, value is not an integer"; p.setStatusCode(QOpcUa::UaStatusCode::BadTypeMismatch); emit m_backend->monitoringStatusChanged(nodeHandle, attr, item, p); @@ -772,7 +772,7 @@ bool QOpen62541Subscription::modifyMonitoredItemParameters(quint64 nodeHandle, Q break; } case QOpcUaMonitoringParameters::Parameter::SamplingInterval: { - if (value.type() != QVariant::Double) { + if (value.metaType().id() != QMetaType::Double) { qCWarning(QT_OPCUA_PLUGINS_OPEN62541) << "Could not modify SamplingInterval, value is not a double"; p.setStatusCode(QOpcUa::UaStatusCode::BadTypeMismatch); emit m_backend->monitoringStatusChanged(nodeHandle, attr, item, p); diff --git a/src/plugins/opcua/open62541/qopen62541valueconverter.cpp b/src/plugins/opcua/open62541/qopen62541valueconverter.cpp index a4fcf23..a6f1166 100644 --- a/src/plugins/opcua/open62541/qopen62541valueconverter.cpp +++ b/src/plugins/opcua/open62541/qopen62541valueconverter.cpp @@ -74,12 +74,12 @@ UA_Variant toOpen62541Variant(const QVariant &value, QOpcUa::Types type) return result; } - if (value.type() == QVariant::List && value.toList().size() == 0) + if (value.metaType().id() == QMetaType::QVariantList && value.toList().size() == 0) return open62541value; - QVariant temp = (value.type() == QVariant::List) ? value.toList().at(0) : value; + QVariant temp = (value.metaType().id() == QMetaType::QVariantList) ? value.toList().at(0) : value; QOpcUa::Types valueType = type == QOpcUa::Undefined ? - QOpcUa::metaTypeToQOpcUaType(static_cast<QMetaType::Type>(temp.type())) : type; + QOpcUa::metaTypeToQOpcUaType(static_cast<QMetaType::Type>(temp.metaType().id())) : type; const UA_DataType *dt = toDataType(valueType); @@ -524,7 +524,7 @@ QVariant arrayToQVariant(const UA_Variant &var, QMetaType::Type type) QVariantList list; for (size_t i = 0; i < var.arrayLength; ++i) { QVariant tempVar = QVariant::fromValue(scalarToQt<TARGETTYPE, UATYPE>(&temp[i])); - if (type != QMetaType::UnknownType && type != static_cast<QMetaType::Type>(tempVar.type())) + if (type != QMetaType::UnknownType && type != static_cast<QMetaType::Type>(tempVar.metaType().id())) tempVar.convert(QMetaType(type)); list.append(tempVar); } @@ -544,7 +544,7 @@ QVariant arrayToQVariant(const UA_Variant &var, QMetaType::Type type) return list; } else if (UA_Variant_isScalar(&var)) { QVariant tempVar = QVariant::fromValue(scalarToQt<TARGETTYPE, UATYPE>(temp)); - if (type != QMetaType::UnknownType && type != static_cast<QMetaType::Type>(tempVar.type())) + if (type != QMetaType::UnknownType && type != static_cast<QMetaType::Type>(tempVar.metaType().id())) tempVar.convert(QMetaType(type)); return tempVar; } else if (var.arrayLength == 0 && var.data == UA_EMPTY_ARRAY_SENTINEL) { @@ -714,7 +714,7 @@ UA_Variant arrayFromQVariant(const QVariant &var, const UA_DataType *type) return open62541value; } - if (var.type() == QVariant::List) { + if (var.metaType().id() == QMetaType::QVariantList) { const QVariantList list = var.toList(); if (list.isEmpty()) return open62541value; |