I am working in a Program in QT where I have a LOGIN Dialog, if the person is logged successfully then the program shows a MainWindow object. There's a Menu Bar in that object. One of the options of the Menu Bar is LOGOUT, then what can I do to make the MainWindow object close or hide and the LOGIN Dialog show again?
Here's what I tried:
In the main.cpp
Dialog login;
if (login.exec() == QDialog::Rejected)
{
return -1;
}
MainWindow mainWindow;
mainWindow.show();
In the LOGOUT function from the Menu Bar:
void MainWindow::on_actionLogOut_triggered()
{
close();
//What else can I do here to make the LOGIN Dialog appear again?
}
I also tried to create a new LOGIN object in the on_actionLogOut_triggered() method but it goes out of the scope and the new Dialog object disappear immediately.