Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is the Macro "QT_BEGIN_NAMESPACE" mean in Qt 5? [duplicate]

Tags:

c++

macros

qt

In Qt 5.6 Example "basicLayout",there is a Macro "QT_BEGIN_NAMESPACE",I try to search for it in Qt Documentation,but I still can't get the answer.So what is the meaning in Qt?

The Code related is here:

#ifndef DIALOG_H
#define DIALOG_H

#include <QDialog>

QT_BEGIN_NAMESPACE
class QAction;
class QDialogButtonBox;
class QGroupBox;
class QLabel;
class QLineEdit;
class QMenu;
class QMenuBar;
class QPushButton;
class QTextEdit;
QT_END_NAMESPACE

//! [0]
class Dialog : public QDialog
{
    Q_OBJECT

public:
    Dialog();

private:
    void createMenu();
    void createHorizontalGroupBox();
    void createGridGroupBox();
    void createFormGroupBox();

    enum { NumGridRows = 3, NumButtons = 4 };

    QMenuBar *menuBar;
    QGroupBox *horizontalGroupBox;
    QGroupBox *gridGroupBox;
    QGroupBox *formGroupBox;
    QTextEdit *smallEditor;
    QTextEdit *bigEditor;
    QLabel *labels[NumGridRows];
    QLineEdit *lineEdits[NumGridRows];
    QPushButton *buttons[NumButtons];
    QDialogButtonBox *buttonBox;

    QMenu *fileMenu;
    QAction *exitAction;
};
//! [0]

#endif // DIALOG_H
like image 246
Raphael Avatar asked Jun 19 '16 13:06

Raphael


1 Answers

These are macro you can redefine if you want to build Qt in a specific namespace.

This can be usefull in very particuliar situations, for example if you want to have all Qt's definitions inside a "ExternalFramework::Qt::Version5" namespace.

99.99% of the time, you don't need to change the default value, which is blank. (no namespace)

like image 70
Aurelien Avatar answered Nov 15 '22 11:11

Aurelien