QCPLabelPainterPrivate

Search for usage in LXR

Public Types

enum  AnchorMode { amRectangular , amSkewedUpright , amSkewedRotated }
 
enum  AnchorReferenceType { artNormal , artTangent }
 
enum  AnchorSide {
  asLeft , asRight , asTop , asBottom ,
  asTopLeft , asTopRight , asBottomRight , asBottomLeft
}
 

Public Member Functions

 QCPLabelPainterPrivate (QCustomPlot *parentPlot)
 
bool abbreviateDecimalPowers () const
 
AnchorMode anchorMode () const
 
QPointF anchorReference () const
 
AnchorReferenceType anchorReferenceType () const
 
AnchorSide anchorSide () const
 
int cacheSize () const
 
void clearCache ()
 
QColor color () const
 
void drawTickLabel (QCPPainter *painter, const QPointF &tickPos, const QString &text)
 
QFont font () const
 
QChar multiplicationSymbol () const
 
int padding () const
 
double rotation () const
 
void setAbbreviateDecimalPowers (bool enabled)
 
void setAnchorMode (AnchorMode mode)
 
void setAnchorReference (const QPointF &pixelPoint)
 
void setAnchorReferenceType (AnchorReferenceType type)
 
void setAnchorSide (AnchorSide side)
 
void setCacheSize (int labelCount)
 
void setColor (const QColor &color)
 
void setFont (const QFont &font)
 
void setMultiplicationSymbol (QChar symbol)
 
void setPadding (int padding)
 
void setRotation (double rotation)
 
void setSubstituteExponent (bool enabled)
 
bool substituteExponent () const
 

Static Public Attributes

static const QChar SymbolCross
 
static const QChar SymbolDot
 

Protected Member Functions

void analyzeFontMetrics ()
 
void applyAnchorTransform (LabelData &labelData) const
 
QByteArray cacheKey (const QString &text, const QColor &color, double rotation, AnchorSide side) const
 
CachedLabel * createCachedLabel (const LabelData &labelData) const
 
virtual void drawLabelMaybeCached (QCPPainter *painter, const QFont &font, const QColor &color, const QPointF &pos, AnchorSide side, double rotation, const QString &text)
 
void drawText (QCPPainter *painter, const QPointF &pos, const LabelData &labelData) const
 
virtual QByteArray generateLabelParameterHash () const
 
QPointF getAnchorPos (const QPointF &tickPos)
 
LabelData getTickLabelData (const QFont &font, const QColor &color, double rotation, AnchorSide side, const QString &text) const
 
AnchorSide rotationCorrectedSide (AnchorSide side, double rotation) const
 
AnchorSide skewedAnchorSide (const QPointF &tickPos, double sideExpandHorz, double sideExpandVert) const
 

Protected Attributes

bool mAbbreviateDecimalPowers
 
AnchorMode mAnchorMode
 
QPointF mAnchorReference
 
AnchorReferenceType mAnchorReferenceType
 
AnchorSide mAnchorSide
 
QRect mAxisSelectionBox
 
QColor mColor
 
QFont mFont
 
QCache< QString, CachedLabel > mLabelCache
 
QByteArray mLabelParameterHash
 
QRect mLabelSelectionBox
 
int mLetterCapHeight
 
int mLetterDescent
 
QChar mMultiplicationSymbol
 
int mPadding
 
QCustomPlotmParentPlot
 
double mRotation
 
bool mSubstituteExponent
 
QRect mTickLabelsSelectionBox
 

Detailed Description

(Private)

This is a private class and not part of the public QCustomPlot interface.

Definition at line 1592 of file qcustomplot.h.

Member Enumeration Documentation

◆ AnchorMode

TODO

Definition at line 1599 of file qcustomplot.h.

◆ AnchorReferenceType

TODO

Definition at line 1608 of file qcustomplot.h.

◆ AnchorSide

TODO

Definition at line 1616 of file qcustomplot.h.

Constructor & Destructor Documentation

◆ QCPLabelPainterPrivate()

QCPLabelPainterPrivate::QCPLabelPainterPrivate ( QCustomPlot * parentPlot)
explicit

Constructs a QCPLabelPainterPrivate instance. Make sure to not create a new instance on every redraw, to utilize the caching mechanisms.

the parentPlot does not take ownership of the label painter. Make sure to delete it appropriately.

Definition at line 5484 of file qcustomplot.cpp.

◆ ~QCPLabelPainterPrivate()

QCPLabelPainterPrivate::~QCPLabelPainterPrivate ( )
virtual

Definition at line 5500 of file qcustomplot.cpp.

Member Function Documentation

◆ abbreviateDecimalPowers()

bool QCPLabelPainterPrivate::abbreviateDecimalPowers ( ) const
inline

Definition at line 1655 of file qcustomplot.h.

◆ analyzeFontMetrics()

void QCPLabelPainterPrivate::analyzeFontMetrics ( )
protected

Definition at line 6051 of file qcustomplot.cpp.

◆ anchorMode()

AnchorMode QCPLabelPainterPrivate::anchorMode ( ) const
inline

Definition at line 1645 of file qcustomplot.h.

◆ anchorReference()

QPointF QCPLabelPainterPrivate::anchorReference ( ) const
inline

Definition at line 1647 of file qcustomplot.h.

◆ anchorReferenceType()

AnchorReferenceType QCPLabelPainterPrivate::anchorReferenceType ( ) const
inline

Definition at line 1648 of file qcustomplot.h.

◆ anchorSide()

AnchorSide QCPLabelPainterPrivate::anchorSide ( ) const
inline

Definition at line 1646 of file qcustomplot.h.

◆ applyAnchorTransform()

void QCPLabelPainterPrivate::applyAnchorTransform ( LabelData & labelData) const
protected

Definition at line 5910 of file qcustomplot.cpp.

◆ cacheKey()

QByteArray QCPLabelPainterPrivate::cacheKey ( const QString & text,
const QColor & color,
double rotation,
AnchorSide side ) const
protected

Definition at line 5988 of file qcustomplot.cpp.

◆ cacheSize()

int QCPLabelPainterPrivate::cacheSize ( ) const

Definition at line 5568 of file qcustomplot.cpp.

◆ clearCache()

void QCPLabelPainterPrivate::clearCache ( )

Returns the size ("margin" in QCPAxisRect context, so measured perpendicular to the axis backbone direction) needed to fit the axis.

Clears the internal label cache. Upon the next draw, all labels will be created new. This method is called automatically if any parameters have changed that invalidate the cached labels, such as font, color, etc. Usually you won't need to call this method manually.

Definition at line 5639 of file qcustomplot.cpp.

◆ color()

QColor QCPLabelPainterPrivate::color ( ) const
inline

Definition at line 1650 of file qcustomplot.h.

◆ createCachedLabel()

QCPLabelPainterPrivate::CachedLabel * QCPLabelPainterPrivate::createCachedLabel ( const LabelData & labelData) const
protected

Simulates the steps done by 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 tickLabelsSize is only expanded, if it's currently set to a smaller width/height.

Definition at line 5960 of file qcustomplot.cpp.

◆ drawLabelMaybeCached()

void QCPLabelPainterPrivate::drawLabelMaybeCached ( QCPPainter * painter,
const QFont & font,
const QColor & color,
const QPointF & pos,
AnchorSide side,
double rotation,
const QString & text )
protectedvirtual

Draws a single tick label with the provided painter, utilizing the internal label cache to significantly speed up drawing of labels that were drawn in previous calls. The tick label is always bound to an axis, the distance to the axis is controllable via distanceToAxis in pixels. The pixel position in the axis direction is passed in the position parameter. Hence for the bottom axis, position would indicate the horizontal pixel position (not coordinate), at which the label should be drawn.

In order to later draw the axis label in a place that doesn't overlap with the tick labels, the largest tick label size is needed. This is acquired by passing a tickLabelsSize to the drawTickLabel calls during the process of drawing all tick labels of one axis. In every call, tickLabelsSize is expanded, if the drawn label exceeds the value tickLabelsSize currently holds.

The label is drawn with the font and pen that are currently set on the painter. To draw superscripted powers, the font is temporarily made smaller by a fixed factor (see getTickLabelData).

Definition at line 5683 of file qcustomplot.cpp.

◆ drawText()

void QCPLabelPainterPrivate::drawText ( QCPPainter * painter,
const QPointF & pos,
const LabelData & labelData ) const
protected

This is a placeTickLabel helper function.

Draws the tick label specified in labelData with painter at the pixel positions x and y. This function is used by placeTickLabel to create new tick labels for the cache, or to directly draw the labels on the QCustomPlot surface when label caching is disabled, i.e. when QCP::phCacheLabels plotting hint is not set.

Definition at line 5788 of file qcustomplot.cpp.

◆ drawTickLabel()

void QCPLabelPainterPrivate::drawTickLabel ( QCPPainter * painter,
const QPointF & tickPos,
const QString & text )

Definition at line 5573 of file qcustomplot.cpp.

◆ font()

QFont QCPLabelPainterPrivate::font ( ) const
inline

Definition at line 1649 of file qcustomplot.h.

◆ generateLabelParameterHash()

QByteArray QCPLabelPainterPrivate::generateLabelParameterHash ( ) const
protectedvirtual

Returns a hash that allows uniquely identifying whether the label parameters have changed such that the cached labels must be refreshed (clearCache). It is used in draw. If the return value of this method hasn't changed since the last redraw, the respective label parameters haven't changed and cached labels may be used.

Definition at line 5651 of file qcustomplot.cpp.

◆ getAnchorPos()

QPointF QCPLabelPainterPrivate::getAnchorPos ( const QPointF & tickPos)
protected

Definition at line 5744 of file qcustomplot.cpp.

◆ getTickLabelData()

QCPLabelPainterPrivate::LabelData QCPLabelPainterPrivate::getTickLabelData ( const QFont & font,
const QColor & color,
double rotation,
AnchorSide side,
const QString & text ) const
protected

This is a placeTickLabel helper function.

Transforms the passed text and font to a tickLabelData structure that can then be further processed by getTickLabelDrawOffset and drawTickLabel. It splits the text into base and exponent if necessary (member substituteExponent) and calculates appropriate bounding boxes.

Definition at line 5840 of file qcustomplot.cpp.

◆ multiplicationSymbol()

QChar QCPLabelPainterPrivate::multiplicationSymbol ( ) const
inline

Definition at line 1654 of file qcustomplot.h.

◆ padding()

int QCPLabelPainterPrivate::padding ( ) const
inline

Definition at line 1651 of file qcustomplot.h.

◆ rotation()

double QCPLabelPainterPrivate::rotation ( ) const
inline

Definition at line 1652 of file qcustomplot.h.

◆ rotationCorrectedSide()

QCPLabelPainterPrivate::AnchorSide QCPLabelPainterPrivate::rotationCorrectedSide ( AnchorSide side,
double rotation ) const
protected

Definition at line 6022 of file qcustomplot.cpp.

◆ setAbbreviateDecimalPowers()

void QCPLabelPainterPrivate::setAbbreviateDecimalPowers ( bool enabled)

Definition at line 5558 of file qcustomplot.cpp.

◆ setAnchorMode()

void QCPLabelPainterPrivate::setAnchorMode ( AnchorMode mode)

Definition at line 5509 of file qcustomplot.cpp.

◆ setAnchorReference()

void QCPLabelPainterPrivate::setAnchorReference ( const QPointF & pixelPoint)

Definition at line 5514 of file qcustomplot.cpp.

◆ setAnchorReferenceType()

void QCPLabelPainterPrivate::setAnchorReferenceType ( AnchorReferenceType type)

Definition at line 5519 of file qcustomplot.cpp.

◆ setAnchorSide()

void QCPLabelPainterPrivate::setAnchorSide ( AnchorSide side)

Definition at line 5504 of file qcustomplot.cpp.

◆ setCacheSize()

void QCPLabelPainterPrivate::setCacheSize ( int labelCount)

Definition at line 5563 of file qcustomplot.cpp.

◆ setColor()

void QCPLabelPainterPrivate::setColor ( const QColor & color)

Definition at line 5533 of file qcustomplot.cpp.

◆ setFont()

void QCPLabelPainterPrivate::setFont ( const QFont & font)

Definition at line 5524 of file qcustomplot.cpp.

◆ setMultiplicationSymbol()

void QCPLabelPainterPrivate::setMultiplicationSymbol ( QChar symbol)

Definition at line 5553 of file qcustomplot.cpp.

◆ setPadding()

void QCPLabelPainterPrivate::setPadding ( int padding)

Definition at line 5538 of file qcustomplot.cpp.

◆ setRotation()

void QCPLabelPainterPrivate::setRotation ( double rotation)

Definition at line 5543 of file qcustomplot.cpp.

◆ setSubstituteExponent()

void QCPLabelPainterPrivate::setSubstituteExponent ( bool enabled)

Definition at line 5548 of file qcustomplot.cpp.

◆ skewedAnchorSide()

QCPLabelPainterPrivate::AnchorSide QCPLabelPainterPrivate::skewedAnchorSide ( const QPointF & tickPos,
double sideExpandHorz,
double sideExpandVert ) const
protected

Definition at line 5996 of file qcustomplot.cpp.

◆ substituteExponent()

bool QCPLabelPainterPrivate::substituteExponent ( ) const
inline

Definition at line 1653 of file qcustomplot.h.

Member Data Documentation

◆ mAbbreviateDecimalPowers

bool QCPLabelPainterPrivate::mAbbreviateDecimalPowers
protected

Definition at line 1698 of file qcustomplot.h.

◆ mAnchorMode

AnchorMode QCPLabelPainterPrivate::mAnchorMode
protected

Definition at line 1688 of file qcustomplot.h.

◆ mAnchorReference

QPointF QCPLabelPainterPrivate::mAnchorReference
protected

Definition at line 1690 of file qcustomplot.h.

◆ mAnchorReferenceType

AnchorReferenceType QCPLabelPainterPrivate::mAnchorReferenceType
protected

Definition at line 1691 of file qcustomplot.h.

◆ mAnchorSide

AnchorSide QCPLabelPainterPrivate::mAnchorSide
protected

Definition at line 1689 of file qcustomplot.h.

◆ mAxisSelectionBox

QRect QCPLabelPainterPrivate::mAxisSelectionBox
protected

Definition at line 1703 of file qcustomplot.h.

◆ mColor

QColor QCPLabelPainterPrivate::mColor
protected

Definition at line 1693 of file qcustomplot.h.

◆ mFont

QFont QCPLabelPainterPrivate::mFont
protected

Definition at line 1692 of file qcustomplot.h.

◆ mLabelCache

QCache<QString, CachedLabel> QCPLabelPainterPrivate::mLabelCache
protected

Definition at line 1702 of file qcustomplot.h.

◆ mLabelParameterHash

QByteArray QCPLabelPainterPrivate::mLabelParameterHash
protected

Definition at line 1701 of file qcustomplot.h.

◆ mLabelSelectionBox

QRect QCPLabelPainterPrivate::mLabelSelectionBox
protected

Definition at line 1703 of file qcustomplot.h.

◆ mLetterCapHeight

int QCPLabelPainterPrivate::mLetterCapHeight
protected

Definition at line 1704 of file qcustomplot.h.

◆ mLetterDescent

int QCPLabelPainterPrivate::mLetterDescent
protected

Definition at line 1704 of file qcustomplot.h.

◆ mMultiplicationSymbol

QChar QCPLabelPainterPrivate::mMultiplicationSymbol
protected

Definition at line 1697 of file qcustomplot.h.

◆ mPadding

int QCPLabelPainterPrivate::mPadding
protected

Definition at line 1694 of file qcustomplot.h.

◆ mParentPlot

QCustomPlot* QCPLabelPainterPrivate::mParentPlot
protected

Definition at line 1700 of file qcustomplot.h.

◆ mRotation

double QCPLabelPainterPrivate::mRotation
protected

Definition at line 1695 of file qcustomplot.h.

◆ mSubstituteExponent

bool QCPLabelPainterPrivate::mSubstituteExponent
protected

Definition at line 1696 of file qcustomplot.h.

◆ mTickLabelsSelectionBox

QRect QCPLabelPainterPrivate::mTickLabelsSelectionBox
protected

Definition at line 1703 of file qcustomplot.h.

◆ SymbolCross

const QChar QCPLabelPainterPrivate::SymbolCross
static

Definition at line 1666 of file qcustomplot.h.

◆ SymbolDot

const QChar QCPLabelPainterPrivate::SymbolDot
static

Definition at line 1665 of file qcustomplot.h.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 29 2024 11:57:50 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.