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.
void Window::saveRecentFileList()
{
QSettings settings(m_settingsPath, QSettings::NativeFormat);
settings.setValue("recentFiles/list", QVariant(m_recentFilesList));
}
void Window::restoreRecentFileList()
{
QSettings settings(m_settingsPath, QSettings::NativeFormat);
m_recentFilesList = settings.value("recentFiles/list").toStringList();
}
Try using
QSettings::IniFormat
instead ofQSettings::NativeFormat
. On Windows, you should be usingQSettings::IniFormat
anyways with a specific ini file location. Linux uses ini files as its native format for settings storage, but the QSettings documentation suggests that: