From ee8a5f4917d98a26f8dedd6802eac754d748b227 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Wed, 20 Feb 2019 13:17:51 +0100 Subject: [PATCH] Document that type information is lost when reading QSettings from INI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is quite an important detail for an otherwise useful format. We should make the user aware that they currently have a tradeoff: - Either you can store settings in one place on all platforms that your application targets and have to manually manage conversion from strings, or - Use native formats which can be hard to find and edit, but retain type information. Change-Id: Ic648524c9ebff25246d7cdefb7628ff5ddf84964 Reviewed-by: Jędrzej Nowacki --- src/corelib/io/qsettings.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 0d2bd72d75..ed61c4aca0 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2167,6 +2167,9 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, \snippet settings/settings.cpp 15 + Note that type information is not preserved when reading settings from INI + files; all values will be returned as QString. + The \l{tools/settingseditor}{Settings Editor} example lets you experiment with different settings location and with fallbacks turned on or off. @@ -2448,7 +2451,10 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile, On 32-bit Windows or from a 64-bit application on 64-bit Windows, this works the same as specifying NativeFormat. This enum value was added in Qt 5.7. - \value IniFormat Store the settings in INI files. + \value IniFormat Store the settings in INI files. Note that type information + is not preserved when reading settings from INI files; + all values will be returned as QString. + \value InvalidFormat Special value returned by registerFormat(). \omitvalue CustomFormat1 \omitvalue CustomFormat2