Class QAccelPlot::AxisTickPainter¶
ClassList > QAccelPlot > AxisTickPainter
Internal helper that computes and paints tick marks and labels for a single Axis .More...
#include <AxisTickPainter.hpp>
Classes¶
| Type | Name |
|---|---|
| struct | PaintContext Groups the QPainter context arguments passed into sub-painting helpers. |
| struct | Params All style inputs required for a single paint call, bundled to reduce parameter count. |
Public Types¶
| Type | Name |
|---|---|
| typedef std::function< qreal(qreal value, qreal length)> | MapToPosition Function type that maps a data value to a pixel position along the axis. |
Public Static Functions¶
| Type | Name |
|---|---|
| qreal | computeNiceStep (qreal viewportMin, qreal viewportMax, int tickCount) Returns a "nice" major tick step for the given viewportMin _,_viewportMax range and target__tickCount . |
| AxisTickValues | computeTickValues (qreal viewportMin, qreal viewportMax, bool logScale, const AxisTicker * ticker) Returns the visible tick and subtick values for the viewportMin to__viewportMax range, without labels. |
| AxisTicks | computeTicks (qreal viewportMin, qreal viewportMax, bool logScale, const AxisTicker * ticker) Returns the visible ticks, subticks and formatted labels for the viewportMin to__viewportMax range. |
| void | paintTicks (QPainter * painter, const QRectF & rect, qreal axisX, qreal axisY, const Params & params, const AxisTicks & ticks, const MapToPosition & mapToPosition) Paints ticks and their labels onto__painter , placing them according to__params and__mapToPosition . |
| QSizeF | tickLabelSize (const QFontMetricsF & metrics, const QString & label) Returns the size of the rectangle paintTicks() lays out for__label , measured with__metrics . |
Detailed Description¶
Tick computation and painting are split: computeTicks() formats labels and must run on the formatter's (GUI) thread, while paintTicks() only draws precomputed ticks and is safe to call from Axis::paint() on the render thread. computeTickValues() is the single source of tick positions, shared with GridNode so grid lines stay aligned with the tick marks.
Public Types Documentation¶
typedef MapToPosition¶
Function type that maps a data value to a pixel position along the axis.
Public Static Functions Documentation¶
function computeNiceStep¶
Returns a "nice" major tick step for the given viewportMin _,_viewportMax range and target__tickCount .
static qreal QAccelPlot::AxisTickPainter::computeNiceStep (
qreal viewportMin,
qreal viewportMax,
int tickCount
)
function computeTickValues¶
Returns the visible tick and subtick values for the viewportMin to__viewportMax range, without labels.
static AxisTickValues QAccelPlot::AxisTickPainter::computeTickValues (
qreal viewportMin,
qreal viewportMax,
bool logScale,
const AxisTicker * ticker
)
Does not format labels, so it is safe on the render thread. A linear step never goes below the formatter's TickLabelFormatter::minimumTickStep(). Empty when ticker is null or has no major ticks, and for a collapsed or nonfinite viewport.
function computeTicks¶
Returns the visible ticks, subticks and formatted labels for the viewportMin to__viewportMax range.
static AxisTicks QAccelPlot::AxisTickPainter::computeTicks (
qreal viewportMin,
qreal viewportMax,
bool logScale,
const AxisTicker * ticker
)
Uses log-scale placement when logScale is set and both bounds are positive. Labels are produced by ticker's formatter, which may invoke a QML/JS callback, so this must be called on the formatter's thread.
function paintTicks¶
Paints ticks and their labels onto__painter , placing them according to__params and__mapToPosition .
static void QAccelPlot::AxisTickPainter::paintTicks (
QPainter * painter,
const QRectF & rect,
qreal axisX,
qreal axisY,
const Params & params,
const AxisTicks & ticks,
const MapToPosition & mapToPosition
)
function tickLabelSize¶
Returns the size of the rectangle paintTicks() lays out for__label , measured with__metrics .
static QSizeF QAccelPlot::AxisTickPainter::tickLabelSize (
const QFontMetricsF & metrics,
const QString & label
)
The documentation for this class was generated from the following file QAccelPlot/src/QAccelPlot/axis/AxisTickPainter.hpp