[Interest] Saving existing QSettings
Henry Skoglund
henry at tungware.se
Tue Mar 18 17:12:10 CET 2025
On 2025-03-18 16:52, Josh Grauman wrote:
> Hi,
>
> If I have a QSettings that uses the default settings for each platform
> (ie Windows uses the registry, etc.), is there an (easy) way to save
> the QSettings to an ini file to back it up and restore (on a new
> computer for example)? Something like this (although this doesn't work.
>
> QSettings set1("Company", "Program");
> set1.setValue("key", 1);
>
> QSettings set2("test.ini", QSettings::IniFormat);
> set2 = set1;
Hi, you could try looping thru all the keys in set1, something like:
for (k : set1.allKeys())
set2.setValue(k,set1.value(k));
More information about the Interest
mailing list