Clean up and clarify QLocale docs, especially around number options

Only the numberOptions() getter mentioned that OmitGroupSeparator is
enabled by default for the C locale. Make this clear also in the \enum
documentation and clarify some poorly-phrased descriptions of other
options. Reflow the getter and setter docs.

Change-Id: I1bea1065bd85ba4a6944b110909217c364809497
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Edward Welbourne 2024-11-04 17:48:55 +01:00
parent 629acee840
commit 6ef7bba375
2 changed files with 23 additions and 20 deletions

View File

@ -1271,8 +1271,7 @@ size_t qHash(const QLocale &key, size_t seed) noexcept
/*!
\since 4.2
Sets the \a options related to number conversions for this
QLocale instance.
Sets the \a options related to number conversions for this QLocale instance.
\sa numberOptions(), FloatingPointPrecisionOption
*/
@ -1284,11 +1283,10 @@ void QLocale::setNumberOptions(NumberOptions options)
/*!
\since 4.2
Returns the options related to number conversions for this
QLocale instance.
Returns the options related to number conversions for this QLocale instance.
By default, no options are set for the standard locales, except
for the "C" locale, which has OmitGroupSeparator set by default.
By default, no options are set for the standard locales, except for the "C"
locale, which has OmitGroupSeparator set by default.
\sa setNumberOptions(), toString(), groupSeparator(), FloatingPointPrecisionOption
*/

View File

@ -980,12 +980,15 @@
conversions. They can be retrieved with numberOptions() and set with
setNumberOptions().
\value DefaultNumberOptions This option represents the default behavior, with
group separators, with one leading zero in single digit exponents, and
without trailing zeroes after the decimal dot.
\value OmitGroupSeparator If this option is set, the number-to-string functions
will not insert group separators in their return values. The default
is to insert group separators.
\value DefaultNumberOptions This option represents the default behavior for
all locales except the C locale, with group separators, with one
leading zero in single digit exponents, and without trailing zeroes
at the end of the fractional part (when present).
\value OmitGroupSeparator If this option is set, the number-to-string
functions will not break up digits into groups. The C locale sets
this option by default. The default for all other locales is to
break up digits into groups, in the whole-number part of a number,
with group separators.
\value RejectGroupSeparator If this option is set, the string-to-number functions
will fail if they encounter group separators in their input. The default
is to accept numbers containing correctly placed group separators.
@ -997,14 +1000,16 @@
functions will fail if they encounter an exponent padded with zeroes when
parsing a floating point number in scientific notation. The default is to
accept such padding.
\value IncludeTrailingZeroesAfterDot If this option is set, the number-to-string
functions will pad numbers with zeroes to the requested precision in "g"
or "most concise" mode, even if the number of significant digits is lower
than the requested precision. The default is to omit trailing zeroes.
\value RejectTrailingZeroesAfterDot If this option is set, the string-to-number
functions will fail if they encounter trailing zeroes after the decimal
dot when parsing a number in scientific or decimal representation. The
default is to accept trailing zeroes.
\value IncludeTrailingZeroesAfterDot If this option is set, the
number-to-string functions will pad numbers with zeroes to the
requested precision in "g" or "most concise" mode. The default is to
omit trailing zeroes, which may leave fewer digits in the fractional
part than the precision asked for.
\value RejectTrailingZeroesAfterDot If this option is set, the
string-to-number functions will fail if they encounter trailing
zeroes at the end of the fractional part, when parsing a number in
scientific or decimal representation. The default is to accept
trailing zeroes.
\sa setNumberOptions(), numberOptions(), FloatingPointPrecisionOption
*/