Documentation: Clarify the meaning of the precision parameter for double formatting
Move it to the table for QLocale::toString() to make it more prominent. Explain the meaning for QTextStream::realNumberPrecision(). Change-Id: Ic2da22ff6bea09e79e17f19b4636cef35dc3a615 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit fe4cc2793f80e285be66c36bc1ec6903ddcd312e) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
1fc4b47d8d
commit
a505baf4a5
@ -1400,7 +1400,8 @@ QTextStream::RealNumberNotation QTextStream::realNumberNotation() const
|
|||||||
/*!
|
/*!
|
||||||
Sets the precision of real numbers to \a precision. This value
|
Sets the precision of real numbers to \a precision. This value
|
||||||
describes the number of fraction digits QTextStream should
|
describes the number of fraction digits QTextStream should
|
||||||
write when generating real numbers.
|
write when generating real numbers (FixedNotation, ScientificNotation), or
|
||||||
|
the maximum number of significant digits (SmartNotation).
|
||||||
|
|
||||||
The precision cannot be a negative value. The default value is 6.
|
The precision cannot be a negative value. The default value is 6.
|
||||||
|
|
||||||
@ -1419,7 +1420,9 @@ void QTextStream::setRealNumberPrecision(int precision)
|
|||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the current real number precision, or the number of fraction
|
Returns the current real number precision, or the number of fraction
|
||||||
digits QTextStream will write when generating real numbers.
|
digits QTextStream will write when generating real numbers
|
||||||
|
(FixedNotation, ScientificNotation), or the maximum number of significant
|
||||||
|
digits (SmartNotation).
|
||||||
|
|
||||||
\sa setRealNumberNotation(), realNumberNotation(), numberFlags(), integerBase()
|
\sa setRealNumberNotation(), realNumberNotation(), numberFlags(), integerBase()
|
||||||
*/
|
*/
|
||||||
|
@ -2618,21 +2618,17 @@ static bool qIsUpper(char c)
|
|||||||
The \a format defaults to \c{'g'}. It can be any of the following:
|
The \a format defaults to \c{'g'}. It can be any of the following:
|
||||||
|
|
||||||
\table
|
\table
|
||||||
\header \li Format \li Meaning
|
\header \li Format \li Meaning \li Meaning of \a precision
|
||||||
\row \li \c 'e' \li format as [-]9.9e[+|-]999
|
\row \li \c 'e' \li format as [-]9.9e[+|-]999 \li number of digits \e after the decimal point
|
||||||
\row \li \c 'E' \li format as [-]9.9E[+|-]999
|
\row \li \c 'E' \li format as [-]9.9E[+|-]999 \li "
|
||||||
\row \li \c 'f' \li format as [-]9.9
|
\row \li \c 'f' \li format as [-]9.9 \li "
|
||||||
\row \li \c 'F' \li same as \c 'f' except for INF and NAN (see below)
|
\row \li \c 'F' \li same as \c 'f' except for INF and NAN (see below) \li "
|
||||||
\row \li \c 'g' \li use \c 'e' or \c 'f' format, whichever is more concise
|
\row \li \c 'g' \li use \c 'e' or \c 'f' format, whichever is more concise \li maximum number of significant digits (trailing zeroes are omitted)
|
||||||
\row \li \c 'G' \li use \c 'E' or \c 'F' format, whichever is more concise
|
\row \li \c 'G' \li use \c 'E' or \c 'F' format, whichever is more concise \li "
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
For the \c 'e', \c 'E', \c 'f' and \c 'F' formats, the \a precision
|
The special \a precision value QLocale::FloatingPointShortest selects the
|
||||||
represents the number of digits \e after the decimal point. For the \c 'g'
|
shortest representation that, when read as a number, gets back the original floating-point
|
||||||
and \c 'G' formats, the \a precision represents the maximum number of
|
|
||||||
significant digits (trailing zeroes are omitted). The special \a precision
|
|
||||||
value QLocale::FloatingPointShortest selects the shortest representation
|
|
||||||
that, when read as a number, gets back the original floating-point
|
|
||||||
value. Aside from that, any negative \a precision is ignored in favor of the
|
value. Aside from that, any negative \a precision is ignored in favor of the
|
||||||
default, 6.
|
default, 6.
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user