summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJannis Voelker <jannis.voelker@basyskom.com>2018-06-28 08:37:48 +0200
committerJannis Völker <jannis.voelker@basyskom.com>2018-06-28 08:52:31 +0000
commit7523ab354e38ab6d0aba3e5fe8f24c9c4d1ab032 (patch)
treeafdf5c3ad6570123dbb4db0a26ac1278f4159c76
parent5e2b027283970f2f424d2b57ce035d9a57d29789 (diff)
opcuaviewer: Fix node attribute handling
The QVariant for the Description attribute was not correctly handled, reading the NodeId attribute would have overwritten the display name. Change-Id: I9472f9ceac85964ae93e56fa835cdfa34994bd6c Reviewed-by: Rainer Keller <Rainer.Keller@qt.io>
-rw-r--r--examples/opcua/opcuaviewer/treeitem.cpp4
1 files changed, 1 insertions, 3 deletions
diff --git a/examples/opcua/opcuaviewer/treeitem.cpp b/examples/opcua/opcuaviewer/treeitem.cpp
index b98f9e7..c580b20 100644
--- a/examples/opcua/opcuaviewer/treeitem.cpp
+++ b/examples/opcua/opcuaviewer/treeitem.cpp
@@ -150,7 +150,7 @@ QVariant TreeItem::data(int column)
if (!mAttributesReady)
return tr("Loading ...");
- return mOpcNode->attribute(QOpcUa::NodeAttribute::Description);
+ return mOpcNode->attribute(QOpcUa::NodeAttribute::Description).value<QOpcUa::QLocalizedText>().text;
}
return QVariant();
}
@@ -230,8 +230,6 @@ void TreeItem::handleAttributes(QOpcUa::NodeAttributes attr)
mNodeBrowseName = mOpcNode->attribute(QOpcUa::NodeAttribute::BrowseName).value<QOpcUa::QQualifiedName>().name;
if (attr & QOpcUa::NodeAttribute::DisplayName)
mNodeDisplayName = mOpcNode->attribute(QOpcUa::NodeAttribute::DisplayName).value<QOpcUa::QLocalizedText>().text;
- if (attr & QOpcUa::NodeAttribute::NodeId)
- mNodeDisplayName = mOpcNode->attribute(QOpcUa::NodeAttribute::NodeId).toString();
mAttributesReady = true;
emit mModel->dataChanged(mModel->createIndex(row(), 0, this), mModel->createIndex(row(), numberOfDisplayColumns - 1, this));