I answered something similar elsewhere:
If you mean migrating the files yourself, it's just a matter of copying the file from the old place ~/.config/yourconfigrc to ~/.config/yourapp/yourconfigrc.
If you mean you want the application to manage the migration itself, that's an implementation detail I hadn't thought about yet, but which I assume wouldn't be difficult to do with KConfig.
You can see this bit of code from Konsole showing how to migrate from old entries to new entries in the same config file for example: >https://invent.kde.org/utilities/konsole/-/blob/master/src/main.cpp#L99
The implementation could probably be something similar, with two KConfig/KSharedConfigPtr instances I assume π so:
- if oldConfig exists, create an object for it
- read all oldConfig entries
- if it differs from newConfig, store which ones differ
- write all different oldConfig entries in newConfig object
- sync()
Something like that.