Delete item from QSettings group?
Seems to be the day for questions...
I am using QSettings in .INI format. I have a small group where users can add instrument teach points for use in diagnostics. The group is:
[RobotPoints] point1XXX=456 point1YYY=9280 point2XXX=5240 point2YYY=42
My question is how to remove just one of the entries like: "point2XXX". If the user wants to remove that point how do I do so?
I've looked at .remove() and tried the following:
beginGroup("RobotPoints"); remove("point2XXX"); endGroup()
That did not work. So I then tried:
No luck that way either. I also made calls to sync() after the attempts.
Am I missing something?
What operating system are you using and which version of Qt?
I'm sorry about that. This is Qt 5.5.1 and Windows OS. Win 7 to be exact 32 bit using MSVC compiler.
I assume somewhere in your code you start reading from the ini file. Are you closing the group(s) after reading the settings?
QSettings seem to remember the last open group, so if you do not close it, it tries to remove "RobotPoints/point2XXX" from [RobotPoints] which does not exist.
QSettings s; // do something s.endGroup(); //start deleting points from the settings