How to close a local QDialog?
My application shows an icon in system tray which allows user to quit the application. Sometimes, my app will popup a dialog to let user verify.
Code:
void MyWidget::showWarning()
{
...
...
int result = dialog.exec();
{
...
}
}
The problem is, if the local QDialog object is executing when user quits the app.MyWidget will be deleted before the line is called, which makes the app crash.
So, how do I safely finish the QDialog when the user quits the app?
Re: How to close a local QDialog?
Which version are you using ? I somewhat remember this was a bug in Qt..
anyway you can try catching QCoreApplication::aboutToQuit and closing the dialog yourself :-)
Re: How to close a local QDialog?
Quote:
Originally Posted by
aamer4yu
Which version are you using ? I somewhat remember this was a bug in Qt..
anyway you can try catching
QCoreApplication::aboutToQuit and closing the dialog yourself :-)
I'm using 4.6. Well, I will try that. Thanks~