PDA

View Full Version : CloseEvent() not calling destructor



DURGAPRASAD NEELAM
16th April 2014, 15:36
hi,
i have re implemented CloseEvent(), below is the code. the problem is after i close the tool it is still existing in the processes table (task manager -> processes) and i have observed main window destructor is not calling after this. i am not sure what is the problem. please provide some solution.

Thanks in advance .




void mainwindow::closeEvent(QCloseEvent* f_event)
{
if(flag)
{
if(QMessageBox::Yes == QMessageBox::question(this,"Conformation..",
"file is recording...\nDo you want to close the tool...?",QMessageBox::Yes|QMessageBox::No))
{
QMainWindow::closeEvent(f_event);
}
else
{
f_event->ignore();
return;
}
}
QMainWindow::closeEvent(f_event);
}

anda_skoa
16th April 2014, 16:33
Is this the only window?

If so, is "quit on last window closed" set?
http://qt-project.org/doc/qt-4.8/qapplication.html#quitOnLastWindowClosed-prop

Cheers,
_

DURGAPRASAD NEELAM
18th April 2014, 06:21
yes this is the last window, but this flag is not working for me. i have design mainwindow in designer and the seting up that window to mainwindow ( QMainwindow::setupui(ui) ).

Thanks.
Durga .

anda_skoa
18th April 2014, 09:38
Not sure what you mean. The application doesn't care how you created the window.

So just to be sure: you have verified that the flag is set to true?

If you check the size of the list from QApplication::topLevelWidget() in your closeEvent() handler, how long is it?

Does the program exit when you do not overwrite the closeEvent() handler?

Cheers,
_

DURGAPRASAD NEELAM
19th April 2014, 20:42
hai,
this is because the flag i have set in my application. my problem got solved. thanks for your reply.