#include <QtGui/QApplication>#include <QDialog>#include <QVBoxLayout>#include <QHBoxLayout>#include <QPushButton>#include "mainwindow.h"#include "DialogOptionsDbConnection.h"#include "App.h"int main(int argc, char *argv[]){ QApplication a(argc, argv); QSqlError err = App::Inst().database().connectToDatabase(); if(QSqlError::NoError != err.type()) { QDialog dlg; QPushButton cancelButton("Cancel"); a.connect(&cancelButton, SIGNAL(clicked()), &dlg, SLOT(reject())); QPushButton okButton("OK"); okButton.setDefault(true); a.connect(&okButton, SIGNAL(clicked()), &dlg, SLOT(accept())); QHBoxLayout layoutButtons; layoutButtons.addWidget(&okButton); layoutButtons.addWidget(&cancelButton); QVBoxLayout layoutDialog; ConfigureSQL conn; layoutDialog.addWidget(&conn); layoutDialog.addLayout(&layoutButtons); dlg.setLayout(&layoutDialog); do { dlg.exec(); if(dlg.result() != QDialog::Accepted) { exit(1); } err = App::Inst().database().lastError(); } while(QSqlError::NoError != err.type()); } MainWindow w; w.show(); return a.exec();}