Switching
-
Well thanks, i used this in void MainWindow::on_pushButton_clicked()
@Dialog mDialog ;
this->setVisible(false);
mDialog.exec();
this->setVisible(true);@Now how i can back to main window by press on the back Button ( void Dialog::on_pushButton_clicked() ) in the dialog window ??
Regards.
-
I am not sure that i understand you. Correct me if i'm wrong.
You want create wizzard like app? If yes look at "http://qt-project.org/doc/qt-4.8/qwizard.html":http://qt-project.org/doc/qt-4.8/qwizard.html
Or if you asking how close dialog window by pressing back button then:
@this->close()@
in push button slot. -
Hi!
There are many ways to doing that. It depends of architecture of you project.-
variant:
Make login dialog window as your main window, and put into it some login pass check function:
@if(checkLogin(login, pass)){
Dialog mDialog ;
this->setVisible(false);
mDialog.exec();
this->setVisible(true);
}else{
QMessageBox::information(this, tr("Caption"), tr("Error text"), QMessageBox::Ok);
}@ -
variant:
Make login dialog window as child of your main window. Put somewhere "login" menu or button:
@
Dialog mLoginDialog ;
mLoginDialog.exec();
if(checkLogin(mLoginDialog.getLogin(), mLoginDialog.getPassword())){
//some ini actions
}else{
QMessageBox::information(this, tr("Caption"), tr("Error text"), QMessageBox::Ok);
}
@ -
variant:
Make two separate windows and put login check in main() function:
@int main(int argc, char *argv[])
{
QApplication a(argc, argv);
LoginDialog ld;
if(ld.exec() == QDialog::Accepted){
MainWindow w;
w.show();
}return a.exec();
}@
But i belive everybody doing this in their own way :)
-