What's in it for QT_BEGIN_NAMESPACE and QT_END_NAMESPACE

0

Studying the examples included in Qt-5.9.1 I find the following code that I can not understand:

QT_BEGIN_NAMESPACE
class QAction;
class QMenu;
class QPlainTextEdit;
class QSessionManager;
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{ ... }

My question is: What is your role when creating a class?

    
asked by nullptr 22.08.2017 в 22:14
source

1 answer

0

Qt can be configured to use or not namespaces. For what?

Imagine (to put the first example that occurs to me) that you are migrating an application from one version of Qt to another and in the middle of the change there is a need to remove a version of the application ... having each version of Qt In a different namespace you can prevent names from colliding.

Typically, Qt is not mounted in a namespace, but still these macros will allow you to write code that works well in any situation without having to edit it later.

    
answered by 23.08.2017 в 09:01