[Solved] QSettings key issue
-
Hi Folks,
I would like to use QSettings in my application where I store some resources in .ini file like the following format:
[request]
log="/host/log"Reading the resource file has been done by the following code:
@
Settings("://cfg.ini", QSettings::IniFormat).value("request/log");
@The problem is that is works on Windows properly, but on Linux I'm getting the "QVariant(Invalid)" if I print out by qDebug macro.
Can anybody help me, what do I wrong?
Regards,
Norbert -
@moravas
trySettings(":/cfg.ini", ...
-
Hi,
it could not solve the problem. The behaviour is the same as before.
Regards,
Norbert -
Hi,
Strange, just tested it on OS X and it's working fine. What version of Qt are you using ? On what distribution ?
-
@moravas do you check if the file exists or if the key exists ?
-
Hi,
I'm using Qt 5.5. I thing, the file exist because its compiled to the binary trough the Qt resource management (this .ini file had been added to a .qrc file).
Additionally, I checked the behavioural, and if I put the absolute file path to the constructor of a QSettings, everything work well (e.g.: QSettings("/absolute/path/cfg.ini", QSettings::IniFormat)... ), but trough .qrc file I cannot access any resources in the .ini file.Regads,
Norbert -
What Linux distribution are you using ?
-
Hi SGaist,
sorry for the late reply! The problem seems to be solved. I used same resource file names (for the .qrc) and same names for .ini files.
Additionaly, I managed my work trough subporojects, and I supposed that there won't be any problem with the same file naming because of the different project names. I was wrong.Thank you for your help.
Regards,
Norbert