Unsolved Main Window Hide and Show from another dialogue form
-
Hi, I'm a newbie and in my program I'm just simply trying to create a login form. When the user logs in there is a option to log out. When the user logs out I want to show the main window again. But i'm unable to do so. I can hide the main window but can't bring it back. Any ideas how I might solve the problem
-
@arkantos.tas
Hi.
while you show mainwindow, create dialog and show this.MainWindow w; UserLoginDlg* mydlg = new UserLoginDlg(); mydlg->setModal(true); if(mydlg->exec() == QDialog::Accepted){ w.show(); }else return -1;
QDialog::Accepted
Means that the user has to log in. username and password is Correct.Now left with only two things to do in the dialogue.
if user correct then:
void UserLoginDlg::on_Log_In_clicked()
{
QDialog::accept();
}if user incorrect:
void UserLoginDlg::on_Log_Out_clicked() or The user then cut form
{
QDialog::reject();
} -
@arkantos.tas
ohh, sorry I did not see the problem correctly. I think I wrote the wrong answer. -
@arkantos.tas How do you try to show the main window again?