Ok, it is a bit complicated. I want my application to be restarted from a QDialog executed from the main UI. The way I have created the other UIs executed from my main application is the following:
1) Right Click in Forms->Qt->Qt Designer form Class
2) Edit the UI and add its header file into the mainwindow.cpp in order to be able to execute the dialog through there.
3) Execute the dialog using (e.g. if it is named 'preferences')
Qt Code:
  1. preferences *gamatos= new preferences(this);
  2. gamatos->exec()
To copy to clipboard, switch view to plain text mode 

Well, what I want to do is to call the mainwindow's QCloseEvent from the preferences.cpp.
Actually, in the preferences.cpp I do the following:
Qt Code:
  1. system("/usr/bin/myapp&"); qApp->exit(0);
To copy to clipboard, switch view to plain text mode 
Which executes my app and the closes the current. It's a kind of a restart!
I want, when this restart is given, the closing window to pass through the QCloseEvent of the mainwindow.cpp in order to save some user entries.
I don't know how to create this thread which will go through the 2 forms(mainwindow and preferences)!

Please be a bit specific with your answer because I'm quite newbie. Thx in advance