PDA

View Full Version : Delete dialog



Krish_ng
8th August 2007, 07:49
I hav an application in which i show a Dialog when a key_1 is pressed.Once i enter the mainwindow i do want to delete the dialog objects.Suggest a way in which i can do the
delete of the Dialog.I hav posted sample code

this is in the constructor of mainClass
connect(buttonBar->getButton(),SIGNAL,this,SLOT(showDialog())

showDialog of mainClass look like this
showDialog()
{
buttonBar->showDialog(this);
}

The buttonBar class showDialog looks like this
showDialog(mainClass mc)
{
myDilalog=new myDialog((QWidget *)mc,mc);
myDialog->show();
}
in the mainClass eventfilter i am giving the statement:

buttonBar->showDialog(this); for keypress


where can i delete the dialog.If i tried to delete in eventfilter its showing segmentation fault

marcel
8th August 2007, 08:00
Well, you could try deleting it when the main window is shown the first time ( by overriding showEvent).

Regards

jacek
8th August 2007, 17:28
Maybe it will be simplier if you set the Qt::WA_DeleteOnClose attribute for that dialog?

Krish_ng
9th August 2007, 13:42
I tried using Qt::WA_DeleteOnClose...there is no change in my memory leak..