Qt 5.15.0 QSettings values not reloaded
-
What OS are you on ?
What version of Qt are you using ?Qt is a C++ framework, you allocate an object on the heap and never delete it, thus you leak it. Qt won't automagically delete it for you. If you are thinking about the parent/child model used to manage QObject classes, it is not how it works and is unrelated to the issue at hand.
-
My environment is :
Linux Mint 20
Cinnamon 4.6.6
Kernel 5.4.0-40-genericQt: 5.15.0 QtCreator 4.12.4
OK I think you are still not getting my question? Why does the reloaded values not correspond to the saved values even if the code is changed the way you indicate.
-
My environment is :
Linux Mint 20
Cinnamon 4.6.6
Kernel 5.4.0-40-genericQt: 5.15.0 QtCreator 4.12.4
OK I think you are still not getting my question? Why does the reloaded values not correspond to the saved values even if the code is changed the way you indicate.
@ad5xj
I think, but not sure, that this is to do with internal caching ofQSettings
objects/values.even if the code is changed the way you indicate
Have you actually tried doing that, and see if the problem persists? Give yourself a single
QSettings
object, shared by both read & write code, and try that? -
My environment is :
Linux Mint 20
Cinnamon 4.6.6
Kernel 5.4.0-40-genericQt: 5.15.0 QtCreator 4.12.4
OK I think you are still not getting my question? Why does the reloaded values not correspond to the saved values even if the code is changed the way you indicate.
@ad5xj said in Qt 5.15.0 QSettings values not reloaded:
OK I think you are still not getting my question?
I do get it. However, it's usually simpler to debug code that uses objects properly just in case there's some additional stuff done in for example the destructor of said class which was never called in your case.
The next steps:
- ensure that the paths are indeed the same in both cases (you never know when doing string manipulation)
- check the content of the file (you likely already did)
- do the write and read as two explicit steps using for example two buttons to call the two methods separately.
- check the value of "name" on write
- check the content returned on read before applying the conversion to QString.
-
Did you also try with the Qt version provided by your distribution ?
-
This is just to determine whether this one works correctly which your code.
-
Everything works correctly with my code EXCEPT this one thing. You mentioned earlier it could be an issue with the way QSettings caches values. Is there a way to flush and reload the values?
@ad5xj said in Qt 5.15.0 QSettings values not reloaded:
Is there a way to flush and reload the values?
Documentation is your friend...
-
Did you try to check the status of your QSettings ?
-
Please provide a minimal, compilable example to reproduce the problem. There is no report about such an issue in the bugtracker until now.