When I am using below code on Linux SLES 11 machine the .ini file is recreating for some reason so that I am not able to restore my settings.
Same code working fine on Windows machine.

Prb: I want to have recently opened file list on start up window, so that user can select quickly.

Qt Code:
  1. Window::Window()
  2. {
  3. restoreRecentFileList();
  4. }
  5.  
  6. Window::~Window()
  7. {
  8. saveRecentFileList();
  9. }
  10.  
  11. void Window::saveRecentFileList()
  12. {
  13. QSettings settings(m_settingsPath, QSettings::NativeFormat);
  14. settings.setValue("recentFiles/list", QVariant(m_recentFilesList));
  15. }
  16.  
  17. void Window::restoreRecentFileList()
  18. {
  19. QSettings settings(m_settingsPath, QSettings::NativeFormat);
  20. m_recentFilesList = settings.value("recentFiles/list").toStringList();
  21. }
  22.  
  23. void Window::openFile(QString l_file)
  24. {
  25.  
  26. if(isValidFile(l_file))
  27. {
  28. m_recentFilesList << l_file;
  29.  
  30. done(QDialog::Accepted);
  31. qDebug() << "connected to : " << l_file;
  32. }
  33. else
  34. {
  35. QMessageBox::information(this, "Information", "Please choose valid file", QMessageBox::Ok);
  36. }
  37. }
To copy to clipboard, switch view to plain text mode 

//when i print m_recentFilesList , i am able to see expected values


Qt Code:
  1. on 1st run of Application: no .ini file , after closing App : .ini file have 1 file name stored in it
  2. on 2st run of Application: .ini file have 1 file name stored in it , after closing App : .ini file have 1 file name stored in it
  3. on 1st run of Application: .ini file is empty , ini file is empty
To copy to clipboard, switch view to plain text mode