Easy way to copy QSettings from NativeFormat to IniFormat
-
Hello,
I have update-subprogram in my app and I'm about to merge settings from Windows registry(NativeFormat) to .ini file for more portability(to run from usb stick and save settings on it).is there any easy way to copy all keys, values, groups from one QSettings instance to another?
-
My current implementation looks like that:
@
QSettings s = new QSettings(QDir::toNativeSeparators(qApp->applicationDirPath()+"/settings.ini"),QSettings::IniFormat);if(s->allKeys().count() < 1)
{
QSettings tmp(QSettings::NativeFormat, QSettings::UserScope, "Firm", "App");
if(tmp.allKeys().count() > 0)
{
QStringList keys = tmp.allKeys();
for(unsigned int i = 0; i < keys.count(); i++)
{
s->setValue(keys.at(i), tmp.value(keys.at(i)));
}
}
}
@I'm wondering why is there nothing like QIODevice->copy or at least QSettings::allKeyValuePairs() like with headers in QNetworkRequest/QNetworkResponse...