Examples: Do not wrap custom types in Qt namespace

The Qt namespace should be used for types defined in the Qt library,
not for user types.

Change-Id: I6df0ca054888f4a65b19a9cb44324321d1dcfad8
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit 25c67c608a7a6e8673eee27a105b11d723f9a9b1)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Kai Köhne 2022-12-20 14:14:21 +01:00 committed by Qt Cherry-pick Bot
parent 15b35c7dab
commit e9479d2a22
10 changed files with 1 additions and 41 deletions

View File

@ -6,17 +6,11 @@
#include <QDialog>
QT_BEGIN_NAMESPACE
namespace Ui {
class AddressDialog;
}
QT_END_NAMESPACE
QT_USE_NAMESPACE
class AddressDialog : public QDialog
{
Q_OBJECT

View File

@ -3,8 +3,6 @@
#include "association.h"
QT_BEGIN_NAMESPACE
DtlsAssociation::DtlsAssociation(const QHostAddress &address, quint16 port,
const QString &connectionName)
: name(connectionName),
@ -151,5 +149,3 @@ void DtlsAssociation::pingTimeout()
++ping;
}
//! [10]
QT_END_NAMESPACE

View File

@ -6,8 +6,6 @@
#include <QtNetwork>
#include <QtCore>
QT_BEGIN_NAMESPACE
//! [0]
class DtlsAssociation : public QObject
{
@ -45,6 +43,4 @@ private:
};
//! [0]
QT_END_NAMESPACE
#endif // ASSOCIATION_H

View File

@ -7,8 +7,6 @@
int main(int argc, char *argv[])
{
QT_USE_NAMESPACE
QApplication app(argc, argv);
MainWindow window;
window.show();

View File

@ -8,21 +8,15 @@
#include <QList>
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
class QHostAddress;
class QHostInfo;
class DtlsAssociation;
QT_END_NAMESPACE
QT_USE_NAMESPACE
class DtlsAssociation;
class MainWindow : public QMainWindow
{

View File

@ -7,8 +7,6 @@
int main(int argc, char *argv[])
{
QT_USE_NAMESPACE
QApplication a(argc, argv);
MainWindow w;
w.show();

View File

@ -8,15 +8,11 @@
#include <QMainWindow>
QT_BEGIN_NAMESPACE
namespace Ui {
class MainWindow;
}
QT_END_NAMESPACE
QT_USE_NAMESPACE
class MainWindow : public QMainWindow
{
Q_OBJECT

View File

@ -9,15 +9,11 @@
#include <QList>
QT_BEGIN_NAMESPACE
namespace Ui {
class NicSelector;
}
QT_END_NAMESPACE
QT_USE_NAMESPACE
class NicSelector : public QDialog
{
Q_OBJECT

View File

@ -5,8 +5,6 @@
#include <algorithm>
QT_BEGIN_NAMESPACE
namespace {
QString peer_info(const QHostAddress &address, quint16 port)
@ -219,5 +217,3 @@ void DtlsServer::shutdown()
serverSocket.close();
}
//! [14]
QT_END_NAMESPACE

View File

@ -9,8 +9,6 @@
#include <vector>
#include <memory>
QT_BEGIN_NAMESPACE
//! [0]
class DtlsServer : public QObject
{
@ -55,6 +53,4 @@ private:
};
//! [0]
QT_END_NAMESPACE
#endif // SERVER_H