Results 1 to 4 of 4

Thread: How to close QMainWindow and open login dialog

  1. #1
    Join Date
    Aug 2009
    Posts
    2
    Qt products
    Qt4
    Platforms
    Windows

    Default How to close QMainWindow and open login dialog

    The problem goes like this,
    In an application I am building, I have one instance of LoginDialog inherited from QDialog. This takes username and password, if match is not found in the mysql database, the loginvalidate() returns 0. Return type of loginValidate of LoginDialog is used to determine whether or not to exit the program from the event loop in the main function. If match is found, program flow is as usual, opens the main window.

    Now here comes the problem. I have logout button in the QMainWindow inherited class. When it is clicked, private slot, logout() is called, in the logout() slot, i can write close() to close the current instance of QMainWindow, but how can I show to login dialog, Well, making a new object newlogin will help but still, slots in the LoginDialog won't call QMainWindow. What can I do.

    THank you in advance.

    Keeyias

  2. #2
    Join Date
    Jun 2009
    Posts
    2
    Thanks
    1

    Default Re: How to close QMainWindow and open login dialog

    I have Exactly the same problem.

  3. #3
    Join Date
    Sep 2009
    Posts
    140
    Thanks
    4
    Thanked 17 Times in 17 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to close QMainWindow and open login dialog

    What are you doing if the first logging fails? Do you offer to log in again?
    It is quite the same problem, isn't it?

    Are you doing a loop in the main?

  4. #4
    Join Date
    Sep 2009
    Location
    Tashkent, Uzbekistan
    Posts
    107
    Thanks
    1
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to close QMainWindow and open login dialog

    Hi guys, I suggest you to try 2 different approaches:

    1. Just hide/unhide main window;
    2. De/Initialize eveything inside qapplication event loop.

    Another good techniques include move of the login dialog and main window into 2 different threads.

Similar Threads

  1. Open a QMainWindow Object in QDialog Object
    By chuengchuenghq in forum Qt Programming
    Replies: 1
    Last Post: 13th June 2008, 06:33
  2. Open a QMainWindow in full screen mode?
    By probine in forum Qt Programming
    Replies: 7
    Last Post: 29th November 2006, 13:44

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
  •  
Qt is a trademark of The Qt Company.