Added a global var g_mainWindow. And added QMainWindow to constructor