Results 1 to 2 of 2

Thread: right way to open a new window

  1. #1
    Join Date
    Sep 2006
    Posts
    10
    Thanks
    2
    Qt products
    Qt4
    Platforms
    Windows

    Question right way to open a new window

    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:
    Qt Code:
    1. main_window *main = new main_window();
    2. this->close(); // close login
    3. main->show(); // show main
    To copy to clipboard, switch view to plain text mode 

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Kerala
    Posts
    371
    Thanks
    76
    Thanked 37 Times in 32 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: right way to open a new window

    Look at the following code
    Will give you a basic Idea

    Qt Code:
    1. int main( ... ) {
    2. LoginDialog *loginDlg = new LoginDlg;
    3.  
    4. if( loginDlg->exec() != Qt:;Accepted ) {
    5. return 0;
    6. }
    7.  
    8. //check the login Info
    9. delete loginDlg;
    10.  
    11. MainWindow w;
    12. w.show()
    13. return app.exec();
    14. }
    To copy to clipboard, switch view to plain text mode 
    We can't solve problems by using the same kind of thinking we used when we created them

  3. The following 2 users say thank you to sunil.thaha for this useful post:

    BobRooney (23rd August 2011), wind (2nd November 2006)

Similar Threads

  1. Replies: 3
    Last Post: 7th October 2015, 19:43
  2. Replies: 3
    Last Post: 23rd July 2006, 18:02
  3. Move window in Clone Mode
    By ultrabrite in forum Qt Programming
    Replies: 1
    Last Post: 14th June 2006, 18:22
  4. cannot make a main window modal
    By Dark_Tower in forum Qt Programming
    Replies: 12
    Last Post: 23rd March 2006, 10:21
  5. Main window
    By Michiel in forum Qt Tools
    Replies: 1
    Last Post: 20th March 2006, 23:54

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.