! \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. */
| 10526 | smaller width/height. |
| 10527 | */ |
| 10528 | void 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 |