Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    QSettings persist default values

    General and Desktop
    2
    2
    672
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • W
      wrosecrans last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • sierdzio
        sierdzio Moderators last edited by

        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.

        (Z(:^

        1 Reply Last reply Reply Quote 0
        • First post
          Last post