Remove some factually inaccurate notes from QLocale method docs

Three methods parsing strings as numbers claimed not to fall back on
the C locale. In fact, the parsing is somewhat lenient and has long
accepted the digits and signs of the C locale's representations, along
with the U+2212 minus sign, regardless of locale.

The phrasing also tacitly suggested the matching QString function did
fall back to C locale; when, in fact, it (since 6.0) *exclusively*
uses the C locale. So that was misleading, too.

Change-Id: Ida3f2f23b834ced5150bea20d8716756afd48e91
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2022-10-28 16:07:12 +02:00
parent fb4bc5fa26
commit f6b1c875d9

View File

@ -1720,9 +1720,6 @@ QString QLocale::scriptToString(QLocale::Script script)
If \a ok is not \nullptr, failure is reported by setting *\a{ok} If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true. to \c false, and success by setting *\a{ok} to \c true.
This function does not fall back to the 'C' locale if the string
cannot be interpreted in this locale.
This function ignores leading and trailing whitespace. This function ignores leading and trailing whitespace.
\sa toDouble(), toInt(), toString() \sa toDouble(), toInt(), toString()
@ -1738,9 +1735,6 @@ QString QLocale::scriptToString(QLocale::Script script)
If \a ok is not \nullptr, failure is reported by setting *\a{ok} If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true. to \c false, and success by setting *\a{ok} to \c true.
This function does not fall back to the 'C' locale if the string
cannot be interpreted in this locale.
\snippet code/src_corelib_text_qlocale.cpp 3 \snippet code/src_corelib_text_qlocale.cpp 3
Notice that the last conversion returns 1234.0, because '.' is the Notice that the last conversion returns 1234.0, because '.' is the
@ -1942,10 +1936,6 @@ float QLocale::toFloat(QStringView s, bool *ok) const
If \a ok is not \nullptr, failure is reported by setting *\a{ok} If \a ok is not \nullptr, failure is reported by setting *\a{ok}
to \c false, and success by setting *\a{ok} to \c true. to \c false, and success by setting *\a{ok} to \c true.
Unlike QString::toDouble(), this function does not fall back to
the "C" locale if the string cannot be interpreted in this
locale.
\snippet code/src_corelib_text_qlocale.cpp 3-qstringview \snippet code/src_corelib_text_qlocale.cpp 3-qstringview
Notice that the last conversion returns 1234.0, because '.' is the Notice that the last conversion returns 1234.0, because '.' is the