Important: Please read the Qt Code of Conduct -

QSettings persist default values

  • If I have a Qsettings instance, and I call settings.value("pos", QPoint(200, 200)), is there any way to get QSettings to persist that default value into the ini file (or whatever) storage? I'll have a fairly technically capable userbase for my current project, so I'd ideally like the settings they can tinker with outside of the UI to be fairly obvious if they go poking around in regedit or open the ini file in a text editor. It's not a showstopper - I can always just write documentation. But, who reads the documentation? And it'd be nice if the example config was just automatically in sync with the app. I'd have to update documentation by hand, and having it officially documented would probably be more encouragement of tinkering than I actually want to provide.

  • Moderators

    You can remove the INI file, then start your application and close it. QSettings should then create a new settings file, filled with default values.

Log in to reply