I have an atm app that requires a database to be open at all times(user logs in, all information is gathered and displayed on next form). Currently I am adding the database at the beginning of every form but I was wondering if there was a way for me to automatically at the start of the program and access it through db.start() and db.end() functions in a public class.
atmDB = QSqlDatabase::addDatabase("QSQLITE");
atmDB.setDatabaseName(Path_to_DB);
QFileInfo checkFile(Path_to_DB);
if(!atmDB.open()){
ui->regStatus->setText("No connection to log-in database!");
}
else
ui->regStatus->setText("Database connected!");enter code here
I have this at the beginning of everys form source file.