Nominate our 2022 Qt Champions!

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:


    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:


    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?

  • @the_

    I'm sorry about that. This is Qt 5.5.1 and Windows OS. Win 7 to be exact 32 bit using MSVC compiler.

  • @SysTech

    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
    //start deleting points from the settings

Log in to reply