PDA

View Full Version : Why my application quit?



yxtx1984
7th February 2010, 03:15
I meet an problem in mac, after i run an model dialog, the application quit!, I note that i have set the parent of the dialog to NULL, maybe it's the reason that why the application quit, because if i set the parent to some widget, it won't. so i want to know the exact reason. and it work good on Window, althought the parent is NULL.

QFileDialog *pImportDlg = new QFileDialog;
QDesktopWidget* desktop = QApplication::desktop();
pImportDlg->move((desktop->width() - pImportDlg->width())/2, (desktop->height() - pImportDlg->height())/2);
pImportDlg->setFileMode(QFileDialog::ExistingFiles);

if (QDialog::Accepted == pImportDlg->exec())
{
// do something
}

Appreciate for any point!

yxtx1984
7th February 2010, 05:46
I have solve it by my self.
The key is that tha application will quit when the last window closed!, i have call setQuitOnLastWindowClosed and set it to false.
Thank you for concern!