0

I have two classes like below:

class Login(QMainWindow):
    ...
    ...

class WinOne(QMainWindow):
    ...
    ...

Login class has the Login window.

WinOne class has the post-login window.

I am importing these two classes into another module and I want to display the window from the WinOne class after successful login from the login window of the Login class.

I am not sure how to close the first window and open another window.

I am not able to apply this logic.

If someone can suggest just the logic, I'll try to implement.

Nejat
  • 31,784
  • 12
  • 106
  • 138
Ejaz
  • 1,504
  • 3
  • 25
  • 51

1 Answers1

0

You can have a blocking way to show the login dialog and access the results. It can be done by using exec() and seeing the results when it returns :

login = Login()
winOne = WinOne()

if login.exec():
    result = login.successfulLogin;
    if result:
       winOne.show()
    else:
       ...

Another option is to use the asynchronous way. You can have a signal in Login to show the login is successful and connect it to show() slot of WinOne :

QtCore.QObject.connect(login, QtCore.SIGNAL('LoggedIn()'), winOne, QtCore.SLOT('show()'))
Nejat
  • 31,784
  • 12
  • 106
  • 138