Hi

I'm using Qt 5.2 and get a strange looking ini-file when saving changes. Some sections appear twice with duplicate names:
Qt Code:
  1. [%General]
  2. ptt-key=-1, 111
  3. push-to-talk=true
  4. voice-activated=false
  5.  
  6. [display]
  7. desktop-splitter=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x2\xff\xff\xff\xff\xff\xff\xff\xff\x1\0\0\0\x5\x1\0\0\0\x2)
  8. filesheader="@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x1\0\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x1,\0\0\0\x3\x1\0\0\x1\0\0\0\0\0\0\0\0\0\0\0\0\x64\xff\xff\xff\xff\0\0\0\x81\0\0\0\0\0\0\0\x3\0\0\0\x64\0\0\0\x1\0\0\0\0\0\0\0\x64\0\0\0\x1\0\0\0\0\0\0\0\x64\0\0\0\x1\0\0\0\0)"
  9. splitter=@ByteArray(\0\0\0\xff\0\0\0\0\0\0\0\x2\0\0\x1\0\0\0\x1\f\x1\0\0\0\a\x1\0\0\0\x1)
  10. windowposition=291, 138, 637, 545
  11.  
  12. [%General]
  13. push-to-talk=true
  14. voice-activated=false
  15.  
  16. [soundsystem]
  17. mastervolume=255
  18. microphonegain=1000
  19. voice-activation-level=0
To copy to clipboard, switch view to plain text mode 
Why has "general" section been renamed to "%General" and why does the same keys appear twice?
I instantiate my QSettings like this:
Qt Code:
  1. ttSettings = new QSettings(QSettings::IniFormat,
  2. QSettings::UserScope,
  3. QApplication::organizationName(),
  4. QApplication::applicationName(), this);
To copy to clipboard, switch view to plain text mode 
Then I load and and save like this:
Qt Code:
  1. #define SETTINGS_GENERAL_NICKNAME "general/nickname"
  2. #define SETTINGS_GENERAL_GENDER "general/gender"
  3. #define SETTINGS_GENERAL_AUTOAWAY "general/auto-away"
  4. #define SETTINGS_GENERAL_PUSHTOTALK "general/push-to-talk"
  5. #define SETTINGS_GENERAL_PUSHTOTALK_KEY "general/ptt-key"
  6. #define SETTINGS_GENERAL_VOICEACTIVATED "general/voice-activated"
  7.  
  8. //save settings
  9. ttSettings->setValue(SETTINGS_GENERAL_NICKNAME, ui.nicknameEdit->text());
  10. ttSettings->setValue(SETTINGS_GENERAL_GENDER, ui.maleRadioButton->isChecked());
  11. ttSettings->setValue(SETTINGS_GENERAL_AUTOAWAY, ui.awaySpinBox->value());
  12. SaveHotKeySettings(HOTKEY_PUSHTOTALK, m_hotkey);
  13. ttSettings->setValue(SETTINGS_GENERAL_PUSHTOTALK, ui.pttChkBox->isChecked());
  14. ttSettings->setValue(SETTINGS_GENERAL_VOICEACTIVATED, ui.voiceactChkBox->isChecked());
  15. //...
  16. //load settings...
  17. ui.nicknameEdit->setText(ttSettings->value(SETTINGS_GENERAL_NICKNAME).toString());
  18. ui.maleRadioButton->setChecked(ttSettings->value(SETTINGS_GENERAL_GENDER, true).toBool());
  19. ui.femaleRadioButton->setChecked(!ttSettings->value(SETTINGS_GENERAL_GENDER, true).toBool());
  20. ui.awaySpinBox->setValue(ttSettings->value(SETTINGS_GENERAL_AUTOAWAY).toInt());
  21. ui.pttChkBox->setChecked(ttSettings->value(SETTINGS_GENERAL_PUSHTOTALK).toBool());
To copy to clipboard, switch view to plain text mode 
When I restart my application the settings I've saved before are not loaded again. It's like they've been reset. Anyone know what's going on.

-- Bjoern