Hello everyone,
I'm quite stuck on a little problem with a QSettings. The thing is I have 3 .ini files which contains informations and I would like to parse and use them in my program without compiling them in the .exe or adding them to a QtRessource file.
Those three files should be placed at the root of the compiled project folder, and should be editable.
The following code extract works perfectly for a file in a QtRessource
ret = my_settings.value("1501x/data01","0").toInt();
QSettings my_settings(":/datas/min.ini", QSettings::IniFormat);
ret = my_settings.value("1501x/data01","0").toInt();
To copy to clipboard, switch view to plain text mode
But when I try referring to a file outside the QRC, the program fails to load the file apparently, as "ret" takes no value
ret = my_settings.value("1501x/data01","0").toInt();
QSettings my_settings("../min.ini", QSettings::IniFormat);
ret = my_settings.value("1501x/data01","0").toInt();
To copy to clipboard, switch view to plain text mode
Can anyone think of something about this ?
Shoud I use a separate C++ parser instead of a QSettings ?
Thanks for your help !
Added after 21 minutes:
Well, seems like I found a suitable solution for this.
The first problem seemed to be how I wrote the path to this file, now I use a QDir::CurrentPath() to get an absolute path for the file, which is quite more suitable.
Second problem was the shadow building feature, I turned it off and it works perfectly.
ret = my_settings.value("1501x/data01","0").toInt();
QSettings my_settings(QDir::currentPath()+"/min.ini", QSettings::IniFormat);
ret = my_settings.value("1501x/data01","0").toInt();
To copy to clipboard, switch view to plain text mode
Sorry for the quick-auto-solving post !
Bookmarks