Using QSettings fallback mechanism with custom filepaths
Hello,
I have an application into which I'm trying to implement QSettings to take advantage of two particular features: file loading / saving and the fallback mechanism. The existing config files follow INI format, and use the user / system scope hierarchy, but the files use .cfg (not .conf) for their extension. ATM, the only way I can see to override the default .conf extension QSettings uses is to set the path directly when the object is constructed. But, of course, that bypasses the fallback mechanism, which I want to use.
Is there a way to specify a custom file path / file extension, but still use the built-in fallback mechanism?
Re: Using QSettings fallback mechanism with custom filepaths
QSettings uses .conf when the format is NativeFormat or .ini when the Format is IniFormat.
As far as I can tell the only way to use a different extension is to use a different, custom, format.
Cheers,
_
Re: Using QSettings fallback mechanism with custom filepaths
That's what I was afraid of... Of course, that negates the purpose of implementing QSettings. :) Ah well.
Thanks!
Re: Using QSettings fallback mechanism with custom filepaths
If you are in need for more advanced config handling you could have a look at the KConfig addon module: http://www.inqlude.org/libraries/kconfig.html
I can do multiple levels of fallbacks, merge values from different levels, mark entries as immutable by more local files, has a code generator for getting rid of using string based access in application code, etc.
Cheers,
_