Nominate our 2022 Qt Champions!

Where should I place a user configurable resource file?

  • I would like to include a config.xml file with my app that will let the user tweak some settings that are read on startup. It needs to be user editable, so I can't put into a compiled qrc file. I'm trying to figure out the correct place to put it in my project directory; it needs to be copied to both my Debug and Release directories and I also need to be able to load it with QFile("config.xml"); (or some similar local path).

  • Lifetime Qt Champion


    You can have a default version in qrc so that if:

    • It's the application first start
    • The user breaks the file

    you can re-use that one.

    As for the location, you can use QStandardPaths::writableLocation with QStandardPaths::AppConfigLocation to get a proper location for that file.

Log in to reply