vendredi 27 novembre 2015

Find path of .sqlite file in Qt Creator

Okay so I'm relatively new to Qt but I have just finished my first program for a project. I have a .sqlite file that I open by doing this:

 db = QSqlDatabase::addDatabase("QSQLITE");
 db.setDatabaseName("/Users/.../.../Code/Database/AIOCS.sqlite"); //shortened for clarity

I need to send this program to my professor, but obviously if the program tries to compile, the database won't open because the path is wrong. Is there a way to find the path of the file across different platforms that way, when someone tries to run the program it will do so successfully?

Aucun commentaire:

Enregistrer un commentaire