#include #include "formidentification.h" #include "formgestion.h" #include bool createConnection() { // create the default database connection QSqlDatabase *defaultDB = QSqlDatabase::addDatabase( "QMYSQL3" ); if ( ! defaultDB ) { qWarning( "Failed to connect to driver" ); return FALSE; } defaultDB->setDatabaseName( "dbgestnote" ); defaultDB->setUserName( "gestnote" ); defaultDB->setPassword( "mlkhj23" ); defaultDB->setHostName( "localhost" ); if ( ! defaultDB->open() ) { qWarning( "Failed to open books database: " + defaultDB->lastError().driverText() ); qWarning( defaultDB->lastError().databaseText() ); return FALSE; } return TRUE; } int main( int argc, char ** argv ) { QApplication a( argc, argv ); //connexion à la base createConnection(); FormIdentification *w = new FormIdentification; w->exec(); if (w->result()==0) { FormGestion *v=new FormGestion; a.setMainWidget(v); v->show(); } a.connect( &a, SIGNAL( lastWindowClosed() ), &a, SLOT( quit() ) ); return a.exec(); }