From 76f9a768e89351e8b0690cdf2889bc45441f9686 Mon Sep 17 00:00:00 2001 From: Edward Welbourne Date: Wed, 20 Apr 2022 10:45:58 +0200 Subject: [PATCH] Correct documentation of INI format's loss of type information MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Although it loses type information for numeric types, it does preserve the type of most other values. This amends commit ee8a5f4917d98a26f8dedd6802eac754d748b227 Pick-to: 6.3 6.2 5.15 Change-Id: Id4d0e11eabff1874869b940c05055e0bebef5963 Reviewed-by: Thiago Macieira Reviewed-by: MÃ¥rten Nordheim --- src/corelib/io/qsettings.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 0c32345961..57b01ec66d 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -2111,8 +2111,10 @@ 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. + Note that INI files lose the distinction between numeric data and the + strings used to encode them, so values written as numbers shall be read back + as QString. The numeric value can be recovered using \l QString::toInt(), \l + QString::toDouble() and related functions. The \l{tools/settingseditor}{Settings Editor} example lets you experiment with different settings location and with fallbacks @@ -2395,9 +2397,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. Note that type information - is not preserved when reading settings from INI files; - all values will be returned as QString. + \value IniFormat Store the settings in INI files. Note that INI files + lose the distinction between numeric data and the + strings used to encode them, so values written as + numbers shall be read back as QString. \value InvalidFormat Special value returned by registerFormat(). \omitvalue CustomFormat1