how to execute a function after closing a child window in QT

I want to execute a function after closing a child window , here is my code, this do not work as expected

Preferences *dialog = new Preferences();
connect(dialog,SIGNAL(destroyed()),this,SLOT(LoadSettings()));
dialog->show();

Edit: It seems that I mistakenly chose QmainWIndow for preference dialog :-( , can I fix this without porting it into Qdialog? Or is there any easy way to port Qmainwindow ui to Qdialog ui

Answers


Preferences *dialog = new Preferences();
connect(dialog,SIGNAL(destroyed()),this,SLOT(LoadSettings()));
dialog->exec();
delete dialog;

Need Your Help

Android : Search from Large Arraylist

android arrays arraylist

I have a recordset of about 29,000 records. My Screen contains EditText Box for Search Criteria and Listview containing all 29,000 records.