Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Delete item from QSettings group?

Delete item from QSettings group?

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    SysTech
    wrote on last edited by
    #1

    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=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:

    remove("RobotPoints/point2XXX");
    

    No luck that way either. I also made calls to sync() after the attempts.

    Am I missing something?

    1 Reply Last reply
    0
    • the_T Offline
      the_T Offline
      the_
      wrote on last edited by
      #2

      What operating system are you using and which version of Qt?

      -- No support in PM --

      S 1 Reply Last reply
      0
      • the_T the_

        What operating system are you using and which version of Qt?

        S Offline
        S Offline
        SysTech
        wrote on last edited by
        #3

        @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.

        1 Reply Last reply
        0
        • the_T Offline
          the_T Offline
          the_
          wrote on last edited by
          #4

          @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
          s.endGroup();
          //start deleting points from the settings
          

          -- No support in PM --

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved