I want to make a Modal QDialog appear (with exec()) after the MainWindow appears itself.
I tried to call exec in MainWindow::showEvent ( QShowEvent * event ) but It still show before the MainWindow appears.
Any idea how could achieve this ?
thx.
The problem is that your
showEvent()doesn’t return sinceexec()is a blocking call.I would suggest you use
QDialog::open()instead, which opens a modal dialog but is a non-blocking function call. Thus:Note that normal execution of your program continues when calling
open()