MCPcopy Index your code
hub / github.com/Audio4Linux/JDSP4Linux / setNumberFormat

Method setNumberFormat

3rdparty/qcustomplot/qcustomplot.cpp:8714–8767  ·  view source on GitHub ↗

! Sets the number format for the numbers in tick labels. This \a formatCode is an extended version of the format code used e.g. by QString::number() and QLocale::toString(). For reference about that, see the "Argument Formats" section in the detailed description of the QString class. \a formatCode is a string of one, two or three characters. The first character is identical to

Source from the content-addressed store, hash-verified

8712 code will not be changed.
8713*/
8714void QCPAxis::setNumberFormat(const QString &formatCode)
8715{
8716 if (formatCode.isEmpty())
8717 {
8718 qDebug() << Q_FUNC_INFO << "Passed formatCode is empty";
8719 return;
8720 }
8721 mCachedMarginValid = false;
8722
8723 // interpret first char as number format char:
8724 QString allowedFormatChars(QLatin1String("eEfgG"));
8725 if (allowedFormatChars.contains(formatCode.at(0)))
8726 {
8727 mNumberFormatChar = QLatin1Char(formatCode.at(0).toLatin1());
8728 } else
8729 {
8730 qDebug() << Q_FUNC_INFO << "Invalid number format code (first char not in 'eEfgG'):" << formatCode;
8731 return;
8732 }
8733 if (formatCode.length() < 2)
8734 {
8735 mNumberBeautifulPowers = false;
8736 mAxisPainter->numberMultiplyCross = false;
8737 return;
8738 }
8739
8740 // interpret second char as indicator for beautiful decimal powers:
8741 if (formatCode.at(1) == QLatin1Char('b') && (mNumberFormatChar == QLatin1Char('e') || mNumberFormatChar == QLatin1Char('g')))
8742 {
8743 mNumberBeautifulPowers = true;
8744 } else
8745 {
8746 qDebug() << Q_FUNC_INFO << "Invalid number format code (second char not 'b' or first char neither 'e' nor 'g'):" << formatCode;
8747 return;
8748 }
8749 if (formatCode.length() < 3)
8750 {
8751 mAxisPainter->numberMultiplyCross = false;
8752 return;
8753 }
8754
8755 // interpret third char as indicator for dot or cross multiplication symbol:
8756 if (formatCode.at(2) == QLatin1Char('c'))
8757 {
8758 mAxisPainter->numberMultiplyCross = true;
8759 } else if (formatCode.at(2) == QLatin1Char('d'))
8760 {
8761 mAxisPainter->numberMultiplyCross = false;
8762 } else
8763 {
8764 qDebug() << Q_FUNC_INFO << "Invalid number format code (third char neither 'c' nor 'd'):" << formatCode;
8765 return;
8766 }
8767}
8768
8769/*!
8770 Sets the precision of the tick label numbers. See QLocale::toString(double i, char f, int prec)

Callers 1

setupFullAxesBoxMethod · 0.80

Calls 6

lengthMethod · 0.80
setSubstituteExponentMethod · 0.80
isEmptyMethod · 0.45
containsMethod · 0.45
atMethod · 0.45

Tested by

no test coverage detected