! \internal Returns the unicode string representing \a number as superscript. This is used to build unicode fractions in \ref unicodeFraction. */
| 7648 | unicode fractions in \ref unicodeFraction. |
| 7649 | */ |
| 7650 | QString QCPAxisTickerPi::unicodeSuperscript(int number) const |
| 7651 | { |
| 7652 | if (number == 0) |
| 7653 | return QString(QChar(0x2070)); |
| 7654 | |
| 7655 | QString result; |
| 7656 | while (number > 0) |
| 7657 | { |
| 7658 | const int digit = number%10; |
| 7659 | switch (digit) |
| 7660 | { |
| 7661 | case 1: { result.prepend(QChar(0x00B9)); break; } |
| 7662 | case 2: { result.prepend(QChar(0x00B2)); break; } |
| 7663 | case 3: { result.prepend(QChar(0x00B3)); break; } |
| 7664 | default: { result.prepend(QChar(0x2070+digit)); break; } |
| 7665 | } |
| 7666 | number /= 10; |
| 7667 | } |
| 7668 | return result; |
| 7669 | } |
| 7670 | |
| 7671 | /*! \internal |
| 7672 |