Search for usage in LXR

Public Member Functions

 QCPAxisPainterPrivate (QCustomPlot *parentPlot)
QRect axisSelectionBox () const
void clearCache ()
virtual void draw (QCPPainter *painter)
QRect labelSelectionBox () const
virtual int size ()
QRect tickLabelsSelectionBox () const

Public Attributes

bool abbreviateDecimalPowers
QRect axisRect
QPen basePen
QString label
QColor labelColor
QFont labelFont
int labelPadding
QCPLineEnding lowerEnding
bool numberMultiplyCross
int offset
bool reversedEndings
bool substituteExponent
int subTickLengthIn
int subTickLengthOut
QPen subTickPen
QVector< double > subTickPositions
QColor tickLabelColor
QFont tickLabelFont
int tickLabelPadding
double tickLabelRotation
QVector< QStringtickLabels
QCPAxis::LabelSide tickLabelSide
int tickLengthIn
int tickLengthOut
QPen tickPen
QVector< double > tickPositions
QCPAxis::AxisType type
QCPLineEnding upperEnding
QRect viewportRect

Protected Member Functions

virtual void drawTickLabel (QCPPainter *painter, double x, double y, const TickLabelData &labelData) const
virtual QByteArray generateLabelParameterHash () const
virtual void getMaxTickLabelSize (const QFont &font, const QString &text, QSize *tickLabelsSize) const
virtual TickLabelData getTickLabelData (const QFont &font, const QString &text) const
virtual QPointF getTickLabelDrawOffset (const TickLabelData &labelData) const
virtual void placeTickLabel (QCPPainter *painter, double position, int distanceToAxis, const QString &text, QSize *tickLabelsSize)

Protected Attributes

QRect mAxisSelectionBox
QCache< QString, CachedLabel > mLabelCache
QByteArray mLabelParameterHash
QRect mLabelSelectionBox
QRect mTickLabelsSelectionBox

Detailed Description


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

It is used by QCPAxis to do the low-level drawing of axis backbone, tick marks, tick labels and axis label. It also buffers the labels to reduce replot times. The parameters are configured by directly accessing the public member variables.

Definition at line 2368 of file qcustomplot.h.

Constructor & Destructor Documentation

◆ QCPAxisPainterPrivate()

QCPAxisPainterPrivate::QCPAxisPainterPrivate ( QCustomPlot * parentPlot)

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

Definition at line 9882 of file qcustomplot.cpp.

◆ ~QCPAxisPainterPrivate()

QCPAxisPainterPrivate::~QCPAxisPainterPrivate ( )

Definition at line 9907 of file qcustomplot.cpp.

Member Function Documentation

◆ axisSelectionBox()

QRect QCPAxisPainterPrivate::axisSelectionBox ( ) const

Definition at line 2378 of file qcustomplot.h.

◆ clearCache()

void QCPAxisPainterPrivate::clearCache ( )

Clears the internal label cache. Upon the next draw, all labels will be created new. This method is called automatically in draw, if any parameters have changed that invalidate the cached labels, such as font, color, etc.

Definition at line 10157 of file qcustomplot.cpp.

◆ draw()

void QCPAxisPainterPrivate::draw ( QCPPainter * painter)

Draws the axis with the specified painter.

The selection boxes (mAxisSelectionBox, mTickLabelsSelectionBox, mLabelSelectionBox) are set here, too.

Definition at line 9918 of file qcustomplot.cpp.

◆ drawTickLabel()

void QCPAxisPainterPrivate::drawTickLabel ( QCPPainter * painter,
double x,
double y,
const TickLabelData & labelData ) const

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 10290 of file qcustomplot.cpp.

◆ generateLabelParameterHash()

QByteArray QCPAxisPainterPrivate::generateLabelParameterHash ( ) const

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 10169 of file qcustomplot.cpp.

◆ getMaxTickLabelSize()

void QCPAxisPainterPrivate::getMaxTickLabelSize ( const QFont & font,
const QString & text,
QSize * tickLabelsSize ) const

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 10512 of file qcustomplot.cpp.

◆ getTickLabelData()

QCPAxisPainterPrivate::TickLabelData QCPAxisPainterPrivate::getTickLabelData ( const QFont & font,
const QString & text ) const

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 10329 of file qcustomplot.cpp.

◆ getTickLabelDrawOffset()

QPointF QCPAxisPainterPrivate::getTickLabelDrawOffset ( const TickLabelData & labelData) const

This is a placeTickLabel helper function.

Calculates the offset at which the top left corner of the specified tick label shall be drawn. The offset is relative to a point right next to the tick the label belongs to.

This function is thus responsible for e.g. centering tick labels under ticks and positioning them appropriately when they are rotated.

Definition at line 10411 of file qcustomplot.cpp.

◆ labelSelectionBox()

QRect QCPAxisPainterPrivate::labelSelectionBox ( ) const

Definition at line 2380 of file qcustomplot.h.

◆ placeTickLabel()

void QCPAxisPainterPrivate::placeTickLabel ( QCPPainter * painter,
double position,
int distanceToAxis,
const QString & text,
QSize * tickLabelsSize )

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 10201 of file qcustomplot.cpp.

◆ size()

int QCPAxisPainterPrivate::size ( )

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

Definition at line 10111 of file qcustomplot.cpp.

◆ tickLabelsSelectionBox()

QRect QCPAxisPainterPrivate::tickLabelsSelectionBox ( ) const

Definition at line 2379 of file qcustomplot.h.

Member Data Documentation

◆ abbreviateDecimalPowers

bool QCPAxisPainterPrivate::abbreviateDecimalPowers

Definition at line 2401 of file qcustomplot.h.

◆ axisRect

QRect QCPAxisPainterPrivate::axisRect

Definition at line 2399 of file qcustomplot.h.

◆ basePen

QPen QCPAxisPainterPrivate::basePen

Definition at line 2384 of file qcustomplot.h.

◆ label

QString QCPAxisPainterPrivate::label

Definition at line 2389 of file qcustomplot.h.

◆ labelColor

QColor QCPAxisPainterPrivate::labelColor

Definition at line 2388 of file qcustomplot.h.

◆ labelFont

QFont QCPAxisPainterPrivate::labelFont

Definition at line 2387 of file qcustomplot.h.

◆ labelPadding

int QCPAxisPainterPrivate::labelPadding

Definition at line 2386 of file qcustomplot.h.

◆ lowerEnding

QCPLineEnding QCPAxisPainterPrivate::lowerEnding

Definition at line 2385 of file qcustomplot.h.

◆ mAxisSelectionBox

QRect QCPAxisPainterPrivate::mAxisSelectionBox

Definition at line 2423 of file qcustomplot.h.

◆ mLabelCache

QCache<QString, CachedLabel> QCPAxisPainterPrivate::mLabelCache

Definition at line 2422 of file qcustomplot.h.

◆ mLabelParameterHash

QByteArray QCPAxisPainterPrivate::mLabelParameterHash

Definition at line 2421 of file qcustomplot.h.

◆ mLabelSelectionBox

QRect QCPAxisPainterPrivate::mLabelSelectionBox

Definition at line 2423 of file qcustomplot.h.

◆ mParentPlot

QCustomPlot* QCPAxisPainterPrivate::mParentPlot

Definition at line 2420 of file qcustomplot.h.

◆ mTickLabelsSelectionBox

QRect QCPAxisPainterPrivate::mTickLabelsSelectionBox

Definition at line 2423 of file qcustomplot.h.

◆ numberMultiplyCross

bool QCPAxisPainterPrivate::numberMultiplyCross

Definition at line 2394 of file qcustomplot.h.

◆ offset

int QCPAxisPainterPrivate::offset

Definition at line 2400 of file qcustomplot.h.

◆ reversedEndings

bool QCPAxisPainterPrivate::reversedEndings

Definition at line 2402 of file qcustomplot.h.

◆ substituteExponent

bool QCPAxisPainterPrivate::substituteExponent

Definition at line 2393 of file qcustomplot.h.

◆ subTickLengthIn

int QCPAxisPainterPrivate::subTickLengthIn

Definition at line 2395 of file qcustomplot.h.

◆ subTickLengthOut

int QCPAxisPainterPrivate::subTickLengthOut

Definition at line 2395 of file qcustomplot.h.

◆ subTickPen

QPen QCPAxisPainterPrivate::subTickPen

Definition at line 2396 of file qcustomplot.h.

◆ subTickPositions

QVector<double> QCPAxisPainterPrivate::subTickPositions

Definition at line 2404 of file qcustomplot.h.

◆ tickLabelColor

QColor QCPAxisPainterPrivate::tickLabelColor

Definition at line 2398 of file qcustomplot.h.

◆ tickLabelFont

QFont QCPAxisPainterPrivate::tickLabelFont

Definition at line 2397 of file qcustomplot.h.

◆ tickLabelPadding

int QCPAxisPainterPrivate::tickLabelPadding

Definition at line 2390 of file qcustomplot.h.

◆ tickLabelRotation

double QCPAxisPainterPrivate::tickLabelRotation

Definition at line 2391 of file qcustomplot.h.

◆ tickLabels

QVector<QString> QCPAxisPainterPrivate::tickLabels

Definition at line 2406 of file qcustomplot.h.

◆ tickLabelSide

QCPAxis::LabelSide QCPAxisPainterPrivate::tickLabelSide

Definition at line 2392 of file qcustomplot.h.

◆ tickLengthIn

int QCPAxisPainterPrivate::tickLengthIn

Definition at line 2395 of file qcustomplot.h.

◆ tickLengthOut

int QCPAxisPainterPrivate::tickLengthOut

Definition at line 2395 of file qcustomplot.h.

◆ tickPen

QPen QCPAxisPainterPrivate::tickPen

Definition at line 2396 of file qcustomplot.h.

◆ tickPositions

QVector<double> QCPAxisPainterPrivate::tickPositions

Definition at line 2405 of file qcustomplot.h.

◆ type

QCPAxis::AxisType QCPAxisPainterPrivate::type

Definition at line 2383 of file qcustomplot.h.

◆ upperEnding

QCPLineEnding QCPAxisPainterPrivate::upperEnding

Definition at line 2385 of file qcustomplot.h.

◆ viewportRect

QRect QCPAxisPainterPrivate::viewportRect

Definition at line 2399 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 May 17 2024 11:48:28 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.