MCPcopy Create free account
hub / github.com/CieNTi/serial_port_plotter / unicodeSuperscript

Method unicodeSuperscript

qcustomplot/qcustomplot.cpp:6959–6978  ·  view source on GitHub ↗

! \internal Returns the unicode string representing \a number as superscript. This is used to build unicode fractions in \ref unicodeFraction. */

Source from the content-addressed store, hash-verified

6957 unicode fractions in \ref unicodeFraction.
6958*/
6959QString QCPAxisTickerPi::unicodeSuperscript(int number) const
6960{
6961 if (number == 0)
6962 return QString(QChar(0x2070));
6963
6964 QString result;
6965 while (number > 0)
6966 {
6967 const int digit = number%10;
6968 switch (digit)
6969 {
6970 case 1: { result.prepend(QChar(0x00B9)); break; }
6971 case 2: { result.prepend(QChar(0x00B2)); break; }
6972 case 3: { result.prepend(QChar(0x00B3)); break; }
6973 default: { result.prepend(QChar(0x2070+digit)); break; }
6974 }
6975 number /= 10;
6976 }
6977 return result;
6978}
6979
6980/*! \internal
6981

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected