PDA

View Full Version : right way to open a new window



wind
1st November 2006, 10:48
First when the application start I display the login screen. Then after successful login i have to display the main window. What is the right way to close the login screen and display the main window?

At the moment i have something like this:


main_window *main = new main_window();
this->close(); // close login
main->show(); // show main


When i call main_window *main = new main_window(this), then the application is not working right.

I have searched Qt examples & demos but all use just one window.

sunil.thaha
1st November 2006, 11:17
Look at the following code
Will give you a basic Idea




int main( ... ) {
LoginDialog *loginDlg = new LoginDlg;

if( loginDlg->exec() != Qt:;Accepted ) {
return 0;
}

//check the login Info
delete loginDlg;

MainWindow w;
w.show()
return app.exec();
}