I am writing a program which stores all its settings in a QSettings object. Now I would like to give the user the option to change the storage location of his data at any time. Apparantly QSettings does not provide the ability to change its scope and copy all its data to a new location, say from the registry to a file in %APPDATA%.
What I know:
- QSettings::setPath() is used before construction and doesn't affect existing objects.
- The copy operator is private. I could subclass QSettings but I am afraid of settings being lost during the copy operation because of other threads writing simultaneously.
How do I move and retain my program settings on the fly to a new location? I'd really like to achieve this with QSettings if possible.
Would a thread-safe singleton wrapper class be an option?