Unsolved 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 valuem_cameraConfigSettings->value("GeneralMode/autoexposureenable",readError);
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.Thanks
-
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
m_cameraConfigSettings->value("GeneralMode/autoexposureenable",readError);But its given the old value
-
@dhu0504 Did you actually try to call https://doc.qt.io/qt-5/qsettings.html#sync as @mranger90 already suggested?
-
This post is deleted! -
@dhu0504
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.