QSettings is not working properly when update the value in the inifile at run time
I am using QSettings to read the value from the ini file.
I am using following code to read the value
At first time application is launched it read the value correctly. But When application is running, changed the value in the inifile, and again read the value, the current value having the old value only.
Any one give the solution for the problem.
mranger90 last edited by
The doc states that for efficiency the new value may not be written immediately.
Try calling sync() after setting the new value.
Actually i am editing manually in the file.
vi file.ini then update the value
@dhu0504 So, after editing the config file, do you read the settings again in your app? Because QSettings will not do that for you.
Yes. I again read the file using the below command
But its given the old value
steverogger007 last edited by
This post is deleted!
JonB last edited by
As two people have already stated, you must call https://doc.qt.io/qt-5/qsettings.html#sync explicitly if you want to be sure that a change has been written to the external storage file. Period.