Hi, I know this seems to be a stupid question, but I really have a problem. I've got this code:

void Form1:penDialog(){
Dialog *dialog=new Dialog(this);
int result=dialog->exec();

if(result==QDialog::Rejected){
//here I want to close the application
}

delete dialog;
}

Form1 inherits from QMainWindow

I've tried almost everything (qApp->quit(),close()) and nothing works. Maybe someone knows what to do.