Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-40105

OSX Yosemite Preview: QSettings setValue doesn't store the value

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Out of scope
    • Icon: Not Evaluated Not Evaluated
    • None
    • 4.8.6
    • QPA
    • macOS

      With OSX Yosemite QSettings::setValue(name, value) doesn't store the proper settings value.

      Code snippet:

      const float myValue = 1.2f; 
      const float defaultValue = 0.1f; 
      
      QSettings settings( QSettings::UserScope, "QtCompany", "PreferencesTest" ); 
      settings.beginGroup( "/Preferences" ); 
      
      settings.setValue( "/My value", myValue ); 
      float myValueReadFromMemory = settings.value( "/My value", defaultValue ).toFloat(); 
      settings.endGroup(); 
      
      settings.sync(); 
      
      QSettings settingsToRead( QSettings::UserScope, "QtCompany", "PreferencesTest" ); 
      settingsToRead.beginGroup( "/Preferences" ); 
      
      float myValueRead = settingsToRead.value( "/My value", defaultValue ).toFloat(); 
      
      settingsToRead.endGroup(); 
      
      printf( "value %f default %f read %f read(from memory) %f\n", 
      myValue, defaultValue, myValueRead, myValueReadFromMemory ); 
      

      Outputs:

      On Mavericks: 
      value 1.200000 default 0.100000 read 1.200000 read(from memory) 1.200000 
      
      On Yosemite: 
      value 1.200000 default 0.100000 read 0.000000 read(from memory) 0.000000 
      

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            sorvig Morten Sørvig
            kileppal Kimmo Leppälä
            Votes:
            4 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes