CloseEvent problem for early closures and a lenghthy constructor
-
My constructor does a lot initializations and take a little bit before it completes. The problem occurs when the users decides to close out of the application before it has fully initialized and the MainWindow constructor has not fully ran. The close event is successful in stopping all the initializations. If the user waits until the constructor has ran, everything is good. However for the early closings, I can't seem to time it out or wait to accept the event. After stopping the initializations, the constructor finishes in less than a second.
I've tried:
@void MainWindow::closeEvent(QCloseEvent *event)
{// Stop all Initializations stopIniters(); // successfull....after running this, the constructor finishes very // quickly... however, I can't figure how to time the // close event accept while(constructorHasRan == false) ///trying to wait for constructor to run { qApp->processEvents();} ///it stays in this loop event->accept();
}
@ -
What exactly is the problem with that? What are you doing in your constructor? Did you try to block the signals until it is finished?