rendered paste bodyMyMainWindow.h====================#ifndef DASHBOARD_HPP#define DASHBOARD_HPP#include <QtGui>namespace Ui { class Dashboard;}namespace MyNamespace{class MyMainWindow : public QMainWindow{ Q_OBJECTpublic: explicit MyMainWindow(QWidget *parent = 0); ~MyMainWindow(); void simpleMethod();private: Ui::MyMainWindow *ui; QComboBox *comboMy;};} // END namespace MyNamespace#endif // DASHBOARD_HPPMyMainWindow.cpp============================#include "MyMainWindow.hpp"#include "ui_MyMainWindow.h"#include <QtGui>namespace MyNamespace{MyMainWindow::MyMainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MyMainWindow){ ui->setupUi(this); QComboBox *comboMy = new QComboBox;// 1 ************************************// Doing this in constructor works comboMy->addItem("asdf");}MyMainWindow::~MyMainWindow(){ delete ui;}voidMyMainWindow::simpleMethod(){// 2 ***********************************// Bu this does not this->comboMy->addItem("asdf");}} // END namespace MyNamespace