Qt World Summit: Register Today!

QSettings ini format [SOLVED]

  • Hi all,

    My app requirement is an (ugh...) ini file that can be hand edited if required.

    The app will run on Win7 32. The logged in user will be an admin.

    I'm creating Settings as:

    @QSettings(QSettings::IniFormat, QSettings::UserScope, APP_ORG, APP_NAME)@

    Where APP_ORG is "Company"
    APP_NAME is "ICS"

    Everything seems to work however instead of an INI anywhere to be found a registry key is created in the spot mentioned in the documentation.

    I might be missing something but I thought this constructor would basically setup an ini file in the:

    <user>/application data/local/Company/ICS.ini

    What am I missing? Thanks in advance.

  • Lifetime Qt Champion


    You can get the location of the file with QSettings::fileName()

    Hope it helps

  • Hi SGaist,

    Well it doesn't. I did print it:

    Settings file: "\HKEY_CURRENT_USER\Software\CompanyICS"

    Note that it is HKEY_CURRENT_USER. So it is ignoring the Ini format request.

  • Lifetime Qt Champion

    Strangeā€¦ Which version of Qt are you using ?

    In between, you can use the 4th constructor giving a file pathname

  • I have community, 5.4.0, creator 3.3.0. Built Dec 8, 2014.

    I will try the path based constructor. I guess I should file a bug report?

  • Ok I finally figured this out. It turns out there was a Settings object being created from prior testing and somehow that one was getting used in my debug tests. My bad. There appears to be no issue with this!

  • Lifetime Qt Champion

    Good ! It's not an unknown feature :)

    Happy coding !

Log in to reply