For a custom method of naming nulls, see reference [1] for the macros Qt_begin_namespace and Qt_ in the ui_xxx.h generated by the Qt Creator based on the *.ui file for the definition of eng_namespace, see reference [3]. The following resolves the meaning of the following content in the Ui_xxx.h file:
Namespace UI {
class mainwindow:public Ui_mainwindow {};
}//Namespace UI
It is in the namespace of Qt_namespace that defines a child namespace in which a class MainWindow is defined, the class public inherits from the Ui_mainwindow, and the MainWindow itself does not define a new member.
As you can see from the above parsing, there is no direct definition of the Ui_mainwindow object in the MainWindow.cpp file, but instead the object that defines the MainWindow class in the UI namespace!
Also, because the Ui_xxx.h file is contained by other source files, it does not include the header file directly in the MainWindow.cpp, avoiding the longer compile time. Instead, in the MainWindow.cpp file, a namespace is redefined and the Ui::mainwindow is declared in this namespace, as shown in the following code:
Namespace Ui {
class MainWindow;
}
reference materials
[1] C + + base accumulation (1) using namespace Potter custom namespaces and using
[2] QT has a name conflict with other libraries
[3] Qt_begin_namespace, Qt_end_namespace and other problems