QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
类 | 函数
QwtScaleCorner 命名空间参考

Helpers for the corners where perpendicular scale backbones meet 更多...

类

struct  Targets
 Target positions of the perpendicular backbones at one corner 更多...
 

函数

QWT_EXPORT void cornerAxes (QwtAxisId axisId, QwtAxisId &startAxis, QwtAxisId &endAxis)
 The perpendicular axes sharing the start/end corner of an axis
 
QWT_EXPORT qreal nearEdgeShift (QwtAxisId axisId)
 Logical offset of the near band edge from the scale position
 
QWT_EXPORT QwtScaleDraw::CornerMiter miterFlags (const QwtPlot *plot, QwtAxisId axisId)
 Compute the corner miter flags for an axis of a plot
 
QWT_EXPORT Targets widgetTargetPositions (const QwtPlot *plot, QwtAxisId axisId)
 Target positions derived from the axis widgets of the whole plot family
 
QWT_EXPORT Targets layoutTargetPositions (const QwtPlot *plot, QwtAxisId axisId)
 Target positions derived from the plot layout (for QwtPlotRenderer)
 
QWT_EXPORT void widgetExtensions (const QwtPlot *plot, QwtAxisId axisId, qreal devicePixelRatio, int &startExtension, int &endExtension)
 Logical pixels an axis widget must reserve at its ends for the miter
 

详细描述

Helpers for the corners where perpendicular scale backbones meet

When two perpendicular axes are visible, their backbones should intersect at the shared canvas corner instead of ending in a diagonal step. QwtScaleDraw extends (miters) the backbone into the corner for this purpose. These helpers answer the questions around that extension:

Parasite plots share the canvas of their host and stack their axis bands outside of the bands of the host, so the perpendicular band adjacent to the canvas may belong to any plot of the family. The target is the near edge of that innermost band - the band a border tick sits on. Bands stacked farther out are not crossed: extending a backbone to them would draw long lines through the whole axis stack and close the corners of unrelated bands.

All positions are in logical coordinates of the plot the axis belongs to; qQNaN() means "no corner at this end".

函数说明

◆ cornerAxes()

void QwtScaleCorner::cornerAxes ( QwtAxisId  axisId,
QwtAxisId &  startAxis,
QwtAxisId &  endAxis 
)

The perpendicular axes sharing the start/end corner of an axis

参数
axisIdAxis
[out]startAxisPerpendicular axis at the start of the scale
[out]endAxisPerpendicular axis at the end of the scale

◆ layoutTargetPositions()

QwtScaleCorner::Targets QwtScaleCorner::layoutTargetPositions ( const QwtPlot *  plot,
QwtAxisId  axisId 
)

Target positions derived from the plot layout (for QwtPlotRenderer)

Compute where the backbone miter should reach, from the plot layout

参数
plotPlot the axis belongs to
axisIdAxis
返回
Target positions in logical coordinates of the plot layout

Variant of widgetTargetPositions() for QwtPlotRenderer: the renderer activates the plot layout for the paint device and positions the scales from the layout rectangles, so the widget geometries are not a reliable source here. Stacked parasite axes are not rendered into documents and are ignored. The plot layout must be activated when calling.

◆ miterFlags()

QwtScaleDraw::CornerMiter QwtScaleCorner::miterFlags ( const QwtPlot *  plot,
QwtAxisId  axisId 
)

Compute the corner miter flags for an axis of a plot

返回
the corner miter flags for an axis of a plot
参数
plotPlot the axis belongs to
axisIdAxis
返回
Miter flags for the corners shared with visible perpendicular axes

A corner exists when a perpendicular axis is visible and paints a backbone - in the plot itself or anywhere in its family (the host and the sibling parasites sharing the canvas).

◆ nearEdgeShift()

qreal QwtScaleCorner::nearEdgeShift ( QwtAxisId  axisId)

Logical offset of the near band edge from the scale position

返回
1 for top/left axes, 0 for bottom/right axes

Added to a band position before rounding it to device pixels, and subtracted again afterwards: the near edge of a top/left backbone band is the last device pixel of its logical pixel, while the near edge of a bottom/right band is the first one.

参数
axisIdAxis the backbone band belongs to
返回
1 for top/left axes, 0 for bottom/right axes

The near ( canvas side ) edge of a top/left backbone band is the last device pixel of the logical pixel of the scale position, while the near edge of a bottom/right band is the first one: rounding position + shift to device pixels and subtracting the shift again yields the near edge for both cases.

◆ widgetExtensions()

void QwtScaleCorner::widgetExtensions ( const QwtPlot *  plot,
QwtAxisId  axisId,
qreal  devicePixelRatio,
int &  startExtension,
int &  endExtension 
)

Logical pixels an axis widget must reserve at its ends for the miter

Compute how much an axis widget has to reserve for the corner miter

参数
plotPlot the axis belongs to
axisIdAxis
devicePixelRatioDevice pixel ratio of the axis widget
[out]startExtensionLogical pixels to reserve at the start of the scale
[out]endExtensionLogical pixels to reserve at the end of the scale

QwtScaleWidget clips everything painted outside of its rectangle, so a backbone miter reaching the perpendicular backbone is only visible when the widget covers the corner pixels. The extensions are the gap between the widget borders and the outer edge of the perpendicular backbone band the miter reaches, rounded up to whole logical pixels. The caller grows the widget rectangle accordingly and passes the same values to QwtScaleWidget::setCornerExtension(), which keeps the scale span unchanged by absorbing them into the border distances.

◆ widgetTargetPositions()

QwtScaleCorner::Targets QwtScaleCorner::widgetTargetPositions ( const QwtPlot *  plot,
QwtAxisId  axisId 
)

Target positions derived from the axis widgets of the whole plot family

Compute where the backbone miter should reach, from the axis widgets

参数
plotPlot the axis belongs to
axisIdAxis
返回
Target positions in logical coordinates of plot

The targets are derived from the geometry and scale draw positions of the perpendicular axis widgets of the whole plot family. Per end the target is the near edge of the innermost band - the one closest to the canvas, where a border tick sits. Bands stacked farther out are not crossed. Call after the plot layout has been applied to the widgets of the family.