SOLVED: Call MainWindow function from Dialog

Ok I have been doing C++ and Qt for just 2 months. I can say I have mastered them quite well since I had prior programming experience. Except for a few nagging issues like, Am not able to call a public member function of the MainWindow class from inside the cpp file of a dialog class. The code compiles well but there is no response when I click the button connected.
The following code is the private slot of a QPushButton clicked() signal but nothing happens.

I understand that MainWindow is QMainWindow implementation, and it's parent of Dialog. You should use SergioDanielG way using signals, or pass MainWindow reference to Dialog and use it directly. However, it's little strange for me accessing whole MainWindow from child Dialog.

This way or the other you should not create another instance of MainWindow as you shown in your example.