I was wondering how to connect two widgets together. I have two widgets i created on QtDesigner, one being a Login page, and another being a Main Menu. I want to connect them so that when the Login is successful, the user will be redirected to the Main Window, and the Login widget will close automatically. Does anyone know how to do this?
PS. I have the code for the main menu and login in separate .py files
You could do the following:
In your QApp create first a dialogue containing the login widget and execute the dialogue. Depending on the result, either (if login failed) quit the application (or reprompt the user for login), or (if login succeeded) instantiate the main window and show it.
Or: Instantiate and show the main window. Immediately show an application-modal dialogue with the login widget. Depending on the result, either resume operation or quit the application.
Here a snippet from some code, that prompts the user for login and checks it against a DB. The login dialogue is defined as DlgLogin in another file.
The dialogue class is the following (having two line-edit-widgets for the credentials):
The application itself reads: