From 13815e441c6e0bb02daced5546965fde65a0cbb7 Mon Sep 17 00:00:00 2001 From: Bill King Date: Mon, 23 Nov 2009 11:29:05 +1000 Subject: Documentation fixes Changed html tags over to qdoc tags. --- src/declarative/util/qmlnumberformatter.cpp | 92 +++++++++++++++++++++-------- 1 file changed, 68 insertions(+), 24 deletions(-) diff --git a/src/declarative/util/qmlnumberformatter.cpp b/src/declarative/util/qmlnumberformatter.cpp index b09be5b..fce35d9 100644 --- a/src/declarative/util/qmlnumberformatter.cpp +++ b/src/declarative/util/qmlnumberformatter.cpp @@ -97,7 +97,7 @@ QmlNumberFormatter::~QmlNumberFormatter() \qmlproperty string NumberFormatter::text The number in the specified format. -
+ If no format is specified the text will be empty. */ @@ -123,38 +123,82 @@ qreal QmlNumberFormatter::number() const \qmlproperty string NumberFormatter::format The particular format the number will adhere to during the conversion to text. -
+ The format syntax follows a style similar to the Unicode Standard (UTS35). The table below shows the characters, patterns that can be used in the format. - - - - - - - -
Character Meaning
# Any digit(s), zero shows as absent (for leading/trailing zeroes)
0 Implicit digit. Zero will show in the case that the input number is too small.
. Decimal separator. Output decimal seperator will be dependant on system locale.
, Grouping separator. The number of digits (either #, or 0) between the grouping separator and the decimal (or the rightmost digit) will determine the groupingSize)
other Any other character will be taken as a string literal and placed directly into the output string
+ \table + \header + \o Character + \o Meaning + \row + \o # + \o Any digit(s), zero shows as absent (for leading/trailing zeroes). + \row + \o 0 + \o Implicit digit. Zero will show in the case that the input number is too small. + \row + \o . + \o Decimal separator. Output decimal seperator will be dependant on system locale. + \row + \o , + \o Grouping separator. The number of digits (either #, or 0) between the grouping separator and the decimal (or the rightmost digit) will determine the groupingSize). + \row + \o other + \o Any other character will be taken as a string literal and placed directly into the output string. + \endtable - Invalid formats will not guarantee a meaningful text output.
+ Invalid formats will not guarantee a meaningful text output. - \note Input numbers that are too long for the given format will be rounded dependent on precison based on the position of the decimal point + \note Input numbers that are too long for the given format will be rounded dependent on precison based on the position of the decimal point. The following table illustrates the output text created by applying some examples of numeric formats to the formatter. - - - - - - - - - - - -
Format Number Output
### 123456 123456
000 123456 123456
###### 1234 1234
000000 1234 001234
##,##0.## 1234.456 1,234.46 (for US locale)
1 234,46 (for FR locale)
000000,000.# 123456 000,123,456 (for US locale)
000 123 456 (for FR locale)
0.0### 0.999997 1.0
(000) 000 - 000 12345678 (012) 345 - 678
#A1212A
+ \table + \header + \o Format + \o Number + \o Output + \row + \o ### + \o 123456 + \o 123456 + \row + \o 000 + \o 123456 + \o 123456 + \row + \o ###### + \o 1234 + \o 1234 + \row + \o 000000 + \o 1234 + \o 001234 + \row + \o ##,##0.## + \o 1234.456 + \o 1,234.46 (for US locale) + \codeline 1 234,46 (for FR locale) + \row + \o 000000,000.# + \o 123456 + \o 000,123,456 (for US locale) + \codeline 000 123 456 (for FR locale) + \row + \o 0.0### + \o 0.999997 + \o 1.0 + \row + \o (000) 000 - 000 + \o 12345678 + \o (012) 345 - 678 + \row + \o #A + \o 12 + \o 12A + \endtable */ QString QmlNumberFormatter::format() const -- cgit v0.12