PDA

View Full Version : Why when I close QDialog my main application gets killed?



alex chpenst
10th July 2008, 22:31
Hi,
I have a dialog that is started from a context menu of my application. The problem is that when I close the dialog, my application closes as well. How do I make a dialog such that the main application stays running when the dialog is closed? (I open the dialog with a parent widget=0. MyDialog inherits QDialog. My main application is a tray icon on the panel with a context menu).

Thanks a lot!
Alex.


MainApplication::MainApplication()
{
...
myDialog = 0;
}

void MainApplication:: openDialog() {
if (!myDialog)
myDialog = new MyDialog;

myDialog->show();
}

jacek
10th July 2008, 22:33
Set QApplication::quitOnLastWindowClosed property to false.

alex chpenst
10th July 2008, 22:57
works fine, thanks for quick help!!!
alex.