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

Method getMaxTickLabelSize

3rdparty/qcustomplot/qcustomplot.cpp:10528–10547  ·  view source on GitHub ↗

! \internal Simulates the steps done by \ref placeTickLabel by calculating bounding boxes of the text label to be drawn, depending on number format etc. Since only the largest tick label is wanted for the margin calculation, the passed \a tickLabelsSize is only expanded, if it's currently set to a smaller width/height. */

Source from the content-addressed store, hash-verified

10526 smaller width/height.
10527*/
10528void QCPAxisPainterPrivate::getMaxTickLabelSize(const QFont &font, const QString &text, QSize *tickLabelsSize) const
10529{
10530 // note: this function must return the same tick label sizes as the placeTickLabel function.
10531 QSize finalSize;
10532 if (mParentPlot->plottingHints().testFlag(QCP::phCacheLabels) && mLabelCache.contains(text)) // label caching enabled and have cached label
10533 {
10534 const CachedLabel *cachedLabel = mLabelCache.object(text);
10535 finalSize = cachedLabel->pixmap.size()/mParentPlot->bufferDevicePixelRatio();
10536 } else // label caching disabled or no label with this text cached:
10537 {
10538 TickLabelData labelData = getTickLabelData(font, text);
10539 finalSize = labelData.rotatedTotalBounds.size();
10540 }
10541
10542 // expand passed tickLabelsSize if current tick label is larger:
10543 if (finalSize.width() > tickLabelsSize->width())
10544 tickLabelsSize->setWidth(finalSize.width());
10545 if (finalSize.height() > tickLabelsSize->height())
10546 tickLabelsSize->setHeight(finalSize.height());
10547}
10548/* end of 'src/axis/axis.cpp' */
10549
10550

Callers

nothing calls this directly

Calls 3

setWidthMethod · 0.80
containsMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected