summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKai Köhne <kai.koehne@qt.io>2022-12-16 17:50:55 +0100
committerKai Köhne <kai.koehne@qt.io>2022-12-21 13:30:30 +0100
commit9130e5312be92bed90395f09b218f43e01b25077 (patch)
treea28e065de4cadc51c6eb8e23392adb4713d094c3
parentc7a8b897752cad58906ed0a309cefd6ee7bde3ef (diff)
OpcuaViewer: Do not wrap API in Qt namespace
The custom Qt namespace should be reserved for Qt library types, not example types. THerefore remove QT_BEGIN_NAMESPACE, QT_END_NAMESPACE macros. To keep compatibility with a namespaced Qt, we now include the respective headers, instead of pre-declaring Qt types. Also sort include lines while at it. Pick-to: 6.4 6.5 Change-Id: I8c4c6f5f2b5768eae297923e0081820ade8e50f4 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Frank Meerkoetter <frank.meerkoetter@basyskom.com>
-rw-r--r--examples/opcua/opcuaviewer/certificatedialog.cpp4
-rw-r--r--examples/opcua/opcuaviewer/certificatedialog.h4
-rw-r--r--examples/opcua/opcuaviewer/mainwindow.cpp4
-rw-r--r--examples/opcua/opcuaviewer/mainwindow.h13
-rw-r--r--examples/opcua/opcuaviewer/opcuamodel.cpp4
-rw-r--r--examples/opcua/opcuaviewer/opcuamodel.h8
-rw-r--r--examples/opcua/opcuaviewer/treeitem.cpp4
-rw-r--r--examples/opcua/opcuaviewer/treeitem.h9
8 files changed, 12 insertions, 38 deletions
diff --git a/examples/opcua/opcuaviewer/certificatedialog.cpp b/examples/opcua/opcuaviewer/certificatedialog.cpp
index 687da1a..c1c14b9 100644
--- a/examples/opcua/opcuaviewer/certificatedialog.cpp
+++ b/examples/opcua/opcuaviewer/certificatedialog.cpp
@@ -6,8 +6,6 @@
#include <QFile>
#include <QPushButton>
-QT_BEGIN_NAMESPACE
-
CertificateDialog::CertificateDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::CertificateDialog)
@@ -58,5 +56,3 @@ void CertificateDialog::saveCertificate()
file.close();
}
}
-
-QT_END_NAMESPACE
diff --git a/examples/opcua/opcuaviewer/certificatedialog.h b/examples/opcua/opcuaviewer/certificatedialog.h
index 6649be0..c6d04d2 100644
--- a/examples/opcua/opcuaviewer/certificatedialog.h
+++ b/examples/opcua/opcuaviewer/certificatedialog.h
@@ -8,10 +8,10 @@
#include <QSslCertificate>
QT_BEGIN_NAMESPACE
-
namespace Ui {
class CertificateDialog;
}
+QT_END_NAMESPACE
class CertificateDialog : public QDialog
{
@@ -32,6 +32,4 @@ private:
QString m_trustListDirectory;
};
-QT_END_NAMESPACE
-
#endif // CERTIFICATEDIALOG_H
diff --git a/examples/opcua/opcuaviewer/mainwindow.cpp b/examples/opcua/opcuaviewer/mainwindow.cpp
index 100513b..b05605f 100644
--- a/examples/opcua/opcuaviewer/mainwindow.cpp
+++ b/examples/opcua/opcuaviewer/mainwindow.cpp
@@ -18,8 +18,6 @@
#include <QOpcUaHistoryReadRawRequest>
-QT_BEGIN_NAMESPACE
-
static MainWindow *mainWindowGlobal = nullptr;
static QtMessageHandler oldMessageHandler = nullptr;
@@ -487,5 +485,3 @@ void MainWindow::handleReadHistoryDataFinished(QList<QOpcUaHistoryData> results,
}
}
}
-
-QT_END_NAMESPACE
diff --git a/examples/opcua/opcuaviewer/mainwindow.h b/examples/opcua/opcuaviewer/mainwindow.h
index 5b95110..1f59048 100644
--- a/examples/opcua/opcuaviewer/mainwindow.h
+++ b/examples/opcua/opcuaviewer/mainwindow.h
@@ -4,20 +4,19 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-#include <QtOpcUa/QOpcUaHistoryData>
-
+#include <QItemSelection>
#include <QMainWindow>
#include <QOpcUaClient>
-#include <QItemSelection>
-
-QT_BEGIN_NAMESPACE
+#include <QOpcUaHistoryData>
+#include <QOpcUaProvider>
-class QOpcUaProvider;
class OpcUaModel;
+QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
+QT_END_NAMESPACE
class MainWindow : public QMainWindow
{
@@ -68,6 +67,4 @@ private:
QScopedPointer<QOpcUaHistoryReadResponse> mHistoryReadResponse;
};
-QT_END_NAMESPACE
-
#endif // MAINWINDOW_H
diff --git a/examples/opcua/opcuaviewer/opcuamodel.cpp b/examples/opcua/opcuaviewer/opcuamodel.cpp
index af6256f..4996076 100644
--- a/examples/opcua/opcuaviewer/opcuamodel.cpp
+++ b/examples/opcua/opcuaviewer/opcuamodel.cpp
@@ -7,8 +7,6 @@
#include <QOpcUaNode>
#include <QIcon>
-QT_BEGIN_NAMESPACE
-
OpcUaModel::OpcUaModel(QObject *parent) : QAbstractItemModel(parent)
{
}
@@ -129,5 +127,3 @@ int OpcUaModel::columnCount(const QModelIndex &parent) const
return static_cast<TreeItem*>(parent.internalPointer())->columnCount();
return mRootItem ? mRootItem->columnCount() : 0;
}
-
-QT_END_NAMESPACE
diff --git a/examples/opcua/opcuaviewer/opcuamodel.h b/examples/opcua/opcuaviewer/opcuamodel.h
index d42826f..7370e1f 100644
--- a/examples/opcua/opcuaviewer/opcuamodel.h
+++ b/examples/opcua/opcuaviewer/opcuamodel.h
@@ -5,13 +5,13 @@
#define OPCUAMODEL_H
#include "treeitem.h"
+
#include <QAbstractItemModel>
+#include <QOpcUaClient>
#include <QOpcUaNode>
-#include <memory>
-QT_BEGIN_NAMESPACE
+#include <memory>
-class QOpcUaClient;
class TreeItem;
class OpcUaModel : public QAbstractItemModel
@@ -37,6 +37,4 @@ private:
friend class TreeItem;
};
-QT_END_NAMESPACE
-
#endif // OPCUAMODEL_H
diff --git a/examples/opcua/opcuaviewer/treeitem.cpp b/examples/opcua/opcuaviewer/treeitem.cpp
index 0249442..886f6c6 100644
--- a/examples/opcua/opcuaviewer/treeitem.cpp
+++ b/examples/opcua/opcuaviewer/treeitem.cpp
@@ -17,8 +17,6 @@
#include <QMetaEnum>
#include <QPixmap>
-QT_BEGIN_NAMESPACE
-
const int numberOfDisplayColumns = 8; // NodeId, Value, NodeClass, DataType, BrowseName, DisplayName, Description, Historizing
TreeItem::TreeItem(OpcUaModel *model) : QObject(nullptr)
@@ -371,5 +369,3 @@ QString TreeItem::euInformationToString(const QOpcUaEUInformation &info) const
return QStringLiteral("[UnitId: %1, NamespaceUri: \"%2\", DisplayName: %3, Description: %4]").arg(info.unitId()).arg(
info.namespaceUri()).arg(localizedTextToString(info.displayName())).arg(localizedTextToString(info.description()));
}
-
-QT_END_NAMESPACE
diff --git a/examples/opcua/opcuaviewer/treeitem.h b/examples/opcua/opcuaviewer/treeitem.h
index c9d944e..8a18b5d 100644
--- a/examples/opcua/opcuaviewer/treeitem.h
+++ b/examples/opcua/opcuaviewer/treeitem.h
@@ -5,14 +5,13 @@
#define TREEITEM_H
#include <QObject>
+#include <QOpcUaEUInformation>
#include <QOpcUaNode>
-#include <memory>
+#include <QOpcUaRange>
-QT_BEGIN_NAMESPACE
+#include <memory>
class OpcUaModel;
-class QOpcUaRange;
-class QOpcUaEUInformation;
class TreeItem : public QObject
{
@@ -78,6 +77,4 @@ QString TreeItem::numberArrayToString(const QList<T> &vec) const
return list;
}
-QT_END_NAMESPACE
-
#endif // TREEITEM_H