int main(int argc, char *argv[]){ QApplication a(argc, argv); a.setQuitOnLastWindowClosed(true); QDialog *AutorizeForm = new TAutorizeForm(NULL,Qt::FramelessWindowHint); if(AutorizeForm->exec() == QDialog::Accepted) { delete AutorizeForm; QMainForm* mainForm = new QMainForm(); mainForm->show(); return a.exec(); } return 0;}
int main(int argc, char* argv[]){ AuthenticDialogForm dlg; MainForm mf; if (!dlg.exec()==QDialog::Accepted){ return 1; }else { mf.show(); return app.exec(); }}
void AuthenticDialogForm::Request(){ if (!namecomboBox->currentText().isEmpty()) { QSqlQuery query; query.prepare("SELECT operator_pass FROM operators WHERE operator_name=:username"); query.bindValue(":username", namecomboBox->currentText()); bool res=query.exec(); if (!res) QMessageBox::warning(this, tr("Soft"),query.lastError().text()); query.first(); if (query.value(0).toString()== passlineEdit->text()) { accept(); } else { QMessageBox::warning(this, tr("Soft"), tr("Wrong password")); passlineEdit->clear(); } }else { QMessageBox::warning(this, tr("Soft"), tr("Select user name")); }}