28   formatter( QChar thousands, 
bool showThousands, QChar decimal )
 
   48   return QStringLiteral( 
"fraction" );
 
   53   return QObject::tr( 
"Fraction" );
 
   63   std::basic_stringstream<wchar_t> os;
 
   64   os.imbue( std::locale( os.getloc(), 
new formatter( mThousandsSeparator.isNull() ? context.
thousandsSeparator() : mThousandsSeparator,
 
   65                          mShowThousandsSeparator,
 
   68   unsigned long long num;
 
   69   unsigned long long den;
 
   74   const double fixed = std::floor( std::fabs( value ) );
 
   78     if ( mUseDedicatedUnicode && num == 1 && den == 2 )
 
   80     else if ( mUseDedicatedUnicode && num == 1 && den == 3 )
 
   81       res = QChar( 0x2153 );  
 
   82     else if ( mUseDedicatedUnicode && num == 2 && den == 3 )
 
   83       res = QChar( 0x2154 );  
 
   84     else if ( mUseDedicatedUnicode && num == 1 && den == 4 )
 
   86     else if ( mUseDedicatedUnicode && num == 3 && den == 4 )
 
   88     else if ( mUseDedicatedUnicode && num == 1 && den == 5 )
 
   89       res = QChar( 0x2155 );  
 
   90     else if ( mUseDedicatedUnicode && num == 2 && den == 5 )
 
   91       res = QChar( 0x2156 );  
 
   92     else if ( mUseDedicatedUnicode && num == 3 && den == 5 )
 
   93       res = QChar( 0x2157 );  
 
   94     else if ( mUseDedicatedUnicode && num == 4 && den == 5 )
 
   95       res = QChar( 0x2158 );  
 
   96     else if ( mUseDedicatedUnicode && num == 1 && den == 6 )
 
   97       res = QChar( 0x2159 ); 
 
   98     else if ( mUseDedicatedUnicode && num == 5 && den == 6 )
 
   99       res = QChar( 0x215A ); 
 
  100     else if ( mUseDedicatedUnicode && num == 1 && den == 7 )
 
  101       res = QChar( 0x2150 ); 
 
  102     else if ( mUseDedicatedUnicode && num == 1 && den == 8 )
 
  103       res = QChar( 0x215B ); 
 
  104     else if ( mUseDedicatedUnicode && num == 3 && den == 8 )
 
  105       res = QChar( 0x215C ); 
 
  106     else if ( mUseDedicatedUnicode && num == 5 && den == 8 )
 
  107       res = QChar( 0x215D ); 
 
  108     else if ( mUseDedicatedUnicode && num == 7 && den == 8 )
 
  109       res = QChar( 0x215E ); 
 
  110     else if ( mUseDedicatedUnicode && num == 1 && den == 9 )
 
  111       res = QChar( 0x2151 ); 
 
  112     else if ( mUseDedicatedUnicode && num == 1 && den == 10 )
 
  113       res = QChar( 0x2152 ); 
 
  114     else if ( mUseUnicodeSuperSubscript )
 
  115       res = num == 0 ? QString() : QStringLiteral( 
"%1%2%3" ).arg( 
toUnicodeSuperscript( QString::number( num ) ),
 
  119       res = num == 0 ? QString() : QStringLiteral( 
"%2/%3" ).arg( num ).arg( den );
 
  122       os << std::fixed << std::setprecision( 0 );
 
  124       res.prepend( QString::fromStdWString( os.str() ) + 
' ' );
 
  128       res = QString::number( 0 );
 
  135     os << std::fixed << std::setprecision( 10 );
 
  137     res = QString::fromStdWString( os.str() );
 
  140   if ( value > 0 && mShowPlusSign )
 
  155   std::unique_ptr< QgsFractionNumericFormat > res = std::make_unique< QgsFractionNumericFormat >();
 
  157   return res.release();
 
  163   res.insert( QStringLiteral( 
"show_thousand_separator" ), mShowThousandsSeparator );
 
  164   res.insert( QStringLiteral( 
"show_plus" ), mShowPlusSign );
 
  165   res.insert( QStringLiteral( 
"thousand_separator" ), mThousandsSeparator );
 
  166   res.insert( QStringLiteral( 
"use_dedicated_unicode" ), mUseDedicatedUnicode );
 
  167   res.insert( QStringLiteral( 
"use_unicode_supersubscript" ), mUseUnicodeSuperSubscript );
 
  178   return mUseDedicatedUnicode;
 
  183   mUseDedicatedUnicode = enabled;
 
  188   return mUseUnicodeSuperSubscript;
 
  193   mUseUnicodeSuperSubscript = enabled;
 
  198   mShowThousandsSeparator = 
configuration.value( QStringLiteral( 
"show_thousand_separator" ), 
true ).toBool();
 
  199   mShowPlusSign = 
configuration.value( QStringLiteral( 
"show_plus" ), 
false ).toBool();
 
  200   mThousandsSeparator = 
configuration.value( QStringLiteral( 
"thousand_separator" ), QChar() ).toChar();
 
  201   mUseDedicatedUnicode = 
configuration.value( QStringLiteral( 
"use_dedicated_unicode" ), 
false ).toBool();
 
  202   mUseUnicodeSuperSubscript = 
configuration.value( QStringLiteral( 
"use_unicode_supersubscript" ), 
true ).toBool();
 
  207   return mShowThousandsSeparator;
 
  217   return mShowPlusSign;
 
  227   return mThousandsSeparator;
 
  232   mThousandsSeparator = character;
 
  238   for ( 
int i = 0; i < input.size(); ++i )
 
  240     QChar 
c = input.at( i );
 
  242       res[i] =  QChar( 0x2070 ); 
 
  244       res[i] =  QChar( 0x00B9 ); 
 
  246       res[i] =  QChar( 0x00B2 ); 
 
  248       res[i] =  QChar( 0x00B3 ); 
 
  250       res[i] =  QChar( 0x2074 ); 
 
  252       res[i] =  QChar( 0x2075 ); 
 
  254       res[i] =  QChar( 0x2076 ); 
 
  256       res[i] =  QChar( 0x2077 ); 
 
  258       res[i] =  QChar( 0x2078 ); 
 
  260       res[i] =  QChar( 0x2079 ); 
 
  268   for ( 
int i = 0; i < input.size(); ++i )
 
  270     QChar 
c = input.at( i );
 
  272       res[i] =  QChar( 0x2080 ); 
 
  274       res[i] =  QChar( 0x2081 ); 
 
  276       res[i] =  QChar( 0x2082 ); 
 
  278       res[i] =  QChar( 0x2083 ); 
 
  280       res[i] =  QChar( 0x2084 ); 
 
  282       res[i] =  QChar( 0x2085 ); 
 
  284       res[i] =  QChar( 0x2086 ); 
 
  286       res[i] =  QChar( 0x2087 ); 
 
  288       res[i] =  QChar( 0x2088 ); 
 
  290       res[i] =  QChar( 0x2089 ); 
 
A context for numeric formats.
QChar negativeSign() const
Returns the negative sign character.
QChar thousandsSeparator() const
Returns the thousands separator character.
QChar decimalSeparator() const
Returns the decimal separator character.
QChar positiveSign() const
Returns the positive sign character.
The class is used as a container of context for various read/write operations on other objects.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c