I inherited a piece of code as the following:
In the header file:
namespace Ui
{
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
~MainWindow();
private:
Ui::MainWindow *ui;
...
}
In cpp file, the class constructor as defined as below:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
Question is why a pointer to itself in the header file? Is this not just "this" as in C++?
Then in the constructor, ui(new Ui::MainWindow) is used in the constructor. What does it do to the constructor?
Bookmarks