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. How to clear the value of a QSettings
Forum Updated to NodeBB v4.3 + New Features

How to clear the value of a QSettings

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 4.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
    SamFaye
    wrote on last edited by
    #1

    I use this statement to invalidate the value of a QSettings @mySettings.value ("code"). Clear ();@
    But when I do @if (! mySettings.value ("code"). IsValid ())@ it returns true

    How can I do?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jupiter
      wrote on last edited by
      #2

      i think you have to call sync() in between. that forces the settings to be written on disk. and you call 2 different setting values that might also be the problem :)

      1 Reply Last reply
      0
      • G Offline
        G Offline
        goetz
        wrote on last edited by
        #3

        mySettings.value() returns a QVariant. So you clear the contents of the returned variant, not the settings.

        You should try:

        @
        mySettings.remove("code");
        @

        This removes the key and its value from the QSettings object. A sync() is not necessary.

        http://www.catb.org/~esr/faqs/smart-questions.html

        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