I'm trying to set the path to store some custom settings for my app using QSettings::setPath and defaulFormat but both seem to be ignored when I try and use the settings file.
>>> QSettings.setDefaultFormat(QSettings.IniFormat)
>>> QSettings.setPath(QSettings.IniFormat, QSettings.UserScope, "C:\\")
>>> settings3 = QSettings("Balh", "MyApp")
>>> settings3.fileName()
PyQt4.QtCore.QString(u'\\HKEY_CURRENT_USER\\Software\\Balh\\MyApp')
I would like to stay using settings = QSettings()
if I can without having to supply QSettings::IniFormat
to it as it is a cross platform app and should use the native format if the custom path isn't set.
The QSettings documentation misleadingly suggests that the code
is equivalent to
but this is not true. Try this
and you will see that only the second constructor uses the default format. And if you look at the QSettings constructor documentation you will see this confirmed:
Only some of the QSettings constructors honour the default format and you have chosen one that doesn't.