QDialog problem with exec()
Code:
...
form_login l;
{
tmain_form main_form;
main_form.show();
return a.exec();
}
...
Hi I'm using this code to show a login form on the main.cpp file.
When used in this way before the a.exec(), everything works fine.
But when I try this, the exec() is not executed in the usual way, the dialog is closed not waiting for user action.
Code:
tcontrol *control = new tcontrol();
if (control->login())
{
tmain_form main_form;
main_form.show();
return a.exec();
}
and login is just a method wrapping the first code, returning (l.exec() == QDialog::Accepted)
What is the difference?
I'm missing something?
Thanks in advance.
Re: QDialog problem with exec()
Disconnect the lastWindowClosed() signal in the application object from its quit() slot.
Re: QDialog problem with exec()
Quote:
Originally Posted by
wysota
Disconnect the lastWindowClosed() signal in the application object from its quit() slot.
Thanks for the reply.
Before the tcontrol *control = new tcontrol(); line, I use this a.setQuitOnLastWindowClosed(false); as I check on documentation:
Quote:
void QApplication::lastWindowClosed () [signal]
...
This feature can be turned off by setting quitOnLastWindowClosed to false.
but the result is the same.
Re: QDialog problem with exec()
Please provide a minimal compilable example reproducing the problem.