c++ - Qt When will the dialog return QDialog::Rejected -
i'm in trouble. have qdialog login form. when log in, form closes , mainwindow appear. login fine when closes returns qdialog::rejected.
what can prevent return of qdialog::rejected? , when return qdialog::rejected?
code when log in :
void login::on_cmdlogin_clicked() { if( ui->txtusernamelogin->text().isempty() || ui->txtpasslogin->text().isempty() ) { qmessagebox::critical(this, "vocabulary trainer", "please fill in both textboxes.", qmessagebox::ok); return; } user user(filepath + "/users.txt"); if ( user.checkpassword( ui->txtusernamelogin->text(), ui->txtpasslogin->text() )) { username = ui->txtusernamelogin->text(); close(); } else qmessagebox::warning(this, "vocabulary trainer", "sorry, password incorrect.\nplease type in correct password.", qmessagebox::ok); }
main() :
mainwindow w; //real window login lg(0); //login window lg.set_path(workspace_path); lg.setmodal(true); if(lg.exec() == qdialog::rejected) qmessagebox::critical(0, "rr", "", qmessagebox::ok); else w.show(); //shows real window
it'll rejected.
try call done(qdialog::accepted);
instead close();
in login::on_cmdlogin_clicked()
Comments
Post a Comment