Bringing back the parent form(login window) after logging out
-
I've successfully setup a login form that opens a new form into a menu after a login. I added a log out button, but I can't find any way to bring back the login form which is the main window.
I've tried setting the main window as the parent of the new form but it the new form just displays the layout in the same window, not opening a new one.
I've also tried the regular way of opening a new form, instantiating a new object of the mainwindow then calling show(), but that doesn't seem to work either.I searched the problem up for hours but to no result. Any idea how to make that function work?
-
I've successfully setup a login form that opens a new form into a menu after a login. I added a log out button, but I can't find any way to bring back the login form which is the main window.
I've tried setting the main window as the parent of the new form but it the new form just displays the layout in the same window, not opening a new one.
I've also tried the regular way of opening a new form, instantiating a new object of the mainwindow then calling show(), but that doesn't seem to work either.I searched the problem up for hours but to no result. Any idea how to make that function work?
-
Apologies for the vague description. What I meant is that after a successful login, the program opens up a new form. Problem is, I have no idea how to get back to the main window after hiding it. I set up a "log out" button but I couldn't find a way to call the previous form to show again.
Anyways, I've found a plausible solution. I discovered that using QWidgets are not the best way to open a new window (or maybe I'm just a noob at using it).
The new form's layout would always appear inside the main window whenever I called "show()" on it. What I did was switch from using QWidget to QDialog and it seems to work just fine now.Still, thank you for the response!
-
Apologies for the vague description. What I meant is that after a successful login, the program opens up a new form. Problem is, I have no idea how to get back to the main window after hiding it. I set up a "log out" button but I couldn't find a way to call the previous form to show again.
Anyways, I've found a plausible solution. I discovered that using QWidgets are not the best way to open a new window (or maybe I'm just a noob at using it).
The new form's layout would always appear inside the main window whenever I called "show()" on it. What I did was switch from using QWidget to QDialog and it seems to work just fine now.Still, thank you for the response!
@Pastardo I suggest to use https://doc.qt.io/qt-5/qstackedwidget.html then you can easily navigate between different parts of your UI.