I now have the main program working mostly as axeljaeger has suggested, with an additional connection to make the program quit after the last window is closed:
int main(int argc, char *argv[])
{
ALoginView loginView;
AMainView mainView;
loginView.show();
app.connect(&loginView, SIGNAL(accepted()), &mainView, SLOT(show()));
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
return app.exec();
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
ALoginView loginView;
AMainView mainView;
loginView.show();
app.connect(&loginView, SIGNAL(accepted()), &mainView, SLOT(show()));
app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit()));
return app.exec();
}
To copy to clipboard, switch view to plain text mode
It works as expected as long as the login dialog is closed by clicking on the login button. However if I hit the enter key in a textedit instead, the main window is displayed very short, but then the program immediately terminates.
Any ideas what could be the reason? Do I need to quit the program in a different way, or is quitting not necessary at all (such as in axeljaeger's example)?
Bookmarks