Delete item from QSettings group?
-
Hi all,
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=42My 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:
remove("RobotPoints/point2XXX");No luck that way either. I also made calls to sync() after the attempts.
Am I missing something?
-
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