PDA

View Full Version : deleting a parent form from a reject() call from a child QDialog



nass
28th July 2006, 13:36
hello everyone,

i have this application when the main window (a QWidget) calls a child QDialog that is generated to configure some setting.. the quit button for the application is also on that same QDialog form and i can set things up in such a way that quit button is connected to the QDialog::reject() function (QDialog::accept() just closes the QDialog, saving the seetings and returns focus to the main window). the code on the main window looks like


menu =new menuForm(this,"aMenuForm",FALSE,(Qt::WStyle_Customize | Qt::WStyle_NoBorder));
if (menu->exec()==QDialog::Rejected)
{
saveData();
//delete menu;
close(); //closes the main window
}
delete menu;

so menu is executed and a reject call is sent the program must save the data and CLOSE the main form too...
ok now this works BUT what does not work is


mainForm::destroy()
{saveData();
}

cause iin the beginning i was trying to get this to work by calling saveData() on mainForm::destroy()... but it did not run... why not?
thank you in advance for your help.
nass

jacek
28th July 2006, 14:10
Do you use .ui.h files?