July 11, 2011

DarkRoast DarkRoast
Lab Rat
22 posts

[Solved] Login dialog before mainwin

 

Hi all

I am wondering how I can make a login dialog such that mainwindow wont start before the correct credentials are typed in. ie:

  1. int main(int argc, char *argv[])
  2. {
  3.     QApplication a(argc, argv);
  4.  
  5.     MainWindow w;
  6.  
  7.     LoginScreen ls;
  8.     ls.show();
  9.  
  10.     a.processEvents();
  11.  
  12.     w.show(); // this should not show before LoginScreen is finished
  13.     ls.close();
  14.     return a.exec();
  15. }

How can I do this ?
How do I handle if the credentials are wrong, i.e show the LoginScreen again without the mainwindow showing ?

Thanks
DarkRoast

2 replies

July 11, 2011

loladiro loladiro
Lab Rat
596 posts

QDialog::exec () [doc.qt.nokia.com]


Shows the dialog as a modal dialog, blocking until the user closes it. The function returns a DialogCode result.

July 11, 2011

DarkRoast DarkRoast
Lab Rat
22 posts

Thanks allot loladiro!

 
  ‹‹ [SOLVED] QNetworkAccessManager does not emit finished() signal      Problem with horizontal wheelEvent ››

You must log in to post a reply. Not a member yet? Register here!