A abstract base class for drawing scales.
More...
#include <qwt_abstract_scale_draw.h>
|
| virtual void | drawTick (QPainter *painter, double value, double len) const =0 |
| | Draw a tick.
|
| |
| virtual void | drawBackbone (QPainter *painter) const =0 |
| | Draws the baseline of the scale.
|
| |
| virtual void | drawLabel (QPainter *painter, double value) const =0 |
| | Draws the label for a major scale tick.
|
| |
| const QwtText & | tickLabel (const QFont &, double value) const |
| | Convert a value into its representing label and cache it.
|
| |
A abstract base class for drawing scales.
QwtAbstractScaleDraw can be used to draw linear or logarithmic scales.
After a scale division has been specified as a QwtScaleDiv object using setScaleDiv(), the scale can be drawn with the draw() member.
◆ ScaleComponent
Components of a scale.
- See also
- enableComponent(), hasComponent
| Enumerator |
|---|
| Backbone | Backbone = the line where the ticks are located.
|
| Ticks | Ticks.
|
| Labels | Labels.
|
◆ QwtAbstractScaleDraw()
| QwtAbstractScaleDraw::QwtAbstractScaleDraw |
( |
| ) |
|
Constructor.
The range of the scale is initialized to [0, 100], The spacing (distance between ticks and labels) is set to 4, the tick lengths are set to 4,6 and 8 pixels
◆ draw()
| void QwtAbstractScaleDraw::draw |
( |
QPainter * |
painter, |
|
|
const QPalette & |
palette |
|
) |
| const |
|
virtual |
Draw the scale.
- Parameters
-
| painter | The painter |
| palette | Palette, text color is used for the labels, foreground color for ticks and backbone |
◆ drawBackbone()
| virtual void QwtAbstractScaleDraw::drawBackbone |
( |
QPainter * |
painter | ) |
const |
|
protectedpure virtual |
◆ drawLabel()
| virtual void QwtAbstractScaleDraw::drawLabel |
( |
QPainter * |
painter, |
|
|
double |
value |
|
) |
| const |
|
protectedpure virtual |
◆ drawTick()
| virtual void QwtAbstractScaleDraw::drawTick |
( |
QPainter * |
painter, |
|
|
double |
value, |
|
|
double |
len |
|
) |
| const |
|
protectedpure virtual |
◆ enableComponent()
| void QwtAbstractScaleDraw::enableComponent |
( |
ScaleComponent |
component, |
|
|
bool |
enable = true |
|
) |
| |
En/Disable a component of the scale.
- Parameters
-
| component | Scale component |
| enable | On/Off |
- See also
- hasComponent()
◆ extent()
| virtual double QwtAbstractScaleDraw::extent |
( |
const QFont & |
font | ) |
const |
|
pure virtual |
◆ hasComponent()
| bool QwtAbstractScaleDraw::hasComponent |
( |
ScaleComponent |
component | ) |
const |
Check if a component is enabled.
- Parameters
-
- Returns
- true, when component is enabled
- See also
- enableComponent()
◆ invalidateCache()
| void QwtAbstractScaleDraw::invalidateCache |
( |
| ) |
|
◆ isSelected()
| bool QwtAbstractScaleDraw::isSelected |
( |
| ) |
const |
◆ label()
| QwtText QwtAbstractScaleDraw::label |
( |
double |
value | ) |
const |
|
virtual |
Convert a value into its representing label.
The value is converted to a plain text using QLocale().toString(value). This method is often overloaded by applications to have individual labels.
- Parameters
-
- Returns
- Label string.
Reimplemented in QwtCompassScaleDraw, and QwtDateScaleDraw.
◆ maxTickLength()
| double QwtAbstractScaleDraw::maxTickLength |
( |
| ) |
const |
◆ minimumExtent()
| double QwtAbstractScaleDraw::minimumExtent |
( |
| ) |
const |
◆ penWidthF()
| qreal QwtAbstractScaleDraw::penWidthF |
( |
| ) |
const |
- Returns
- Scale pen width
- See also
- setPenWidth()
◆ scaleDiv()
| const QwtScaleDiv & QwtAbstractScaleDraw::scaleDiv |
( |
| ) |
const |
◆ scaleMap() [1/2]
- Returns
- Map how to translate between scale and pixel values
◆ scaleMap() [2/2]
| const QwtScaleMap & QwtAbstractScaleDraw::scaleMap |
( |
| ) |
const |
- Returns
- Map how to translate between scale and pixel values
◆ selectedPenWidthOffset()
| qreal QwtAbstractScaleDraw::selectedPenWidthOffset |
( |
| ) |
const |
◆ setMinimumExtent()
| void QwtAbstractScaleDraw::setMinimumExtent |
( |
double |
minExtent | ) |
|
Set a minimum for the extent.
The extent is calculated from the components of the scale draw. In situations, where the labels are changing and the layout depends on the extent (f.e scrolling a scale), setting an upper limit as minimum extent will avoid jumps of the layout.
- Parameters
-
- See also
- extent(), minimumExtent()
◆ setPenWidthF()
| void QwtAbstractScaleDraw::setPenWidthF |
( |
qreal |
width | ) |
|
Specify the width of the scale pen.
- Parameters
-
- See also
- penWidth()
◆ setScaleDiv()
| void QwtAbstractScaleDraw::setScaleDiv |
( |
const QwtScaleDiv & |
scaleDiv | ) |
|
Change the scale division.
- Parameters
-
| scaleDiv | New scale division |
◆ setSelected()
| void QwtAbstractScaleDraw::setSelected |
( |
bool |
on | ) |
|
◆ setSelectedPenWidthOffset()
| void QwtAbstractScaleDraw::setSelectedPenWidthOffset |
( |
qreal |
offset = 1 | ) |
|
设置坐标轴在选中状态下的画笔宽度附加值
当一个坐标轴(例如 X 轴或 Y 轴)被用户选中时,其绘制的画笔宽度会 在原始宽度的基础上增加这个附加值,从而实现视觉上的突出显示效果。
- Parameters
-
| offset | 选中时增加的宽度值(单位:像素)。 该值应为非负数。如果为 0,则选中状态下的线宽与普通状态相同。 |
- See also
- selectedPenWidthOffset()
◆ setSpacing()
| void QwtAbstractScaleDraw::setSpacing |
( |
double |
spacing | ) |
|
Set the spacing between tick and labels.
The spacing is the distance between ticks and labels. The default spacing is 4 pixels.
- Parameters
-
- See also
- spacing()
◆ setTickLength()
Set the length of the ticks.
- Parameters
-
| tickType | Tick type |
| length | New length |
- Warning
- the length is limited to [0..1000]
◆ setTransformation()
| void QwtAbstractScaleDraw::setTransformation |
( |
QwtTransform * |
transformation | ) |
|
Change the transformation of the scale.
- Parameters
-
| transformation | New scale transformation |
◆ spacing()
| double QwtAbstractScaleDraw::spacing |
( |
| ) |
const |
Get the spacing.
The spacing is the distance between ticks and labels. The default spacing is 4 pixels.
- Returns
- Spacing
- See also
- setSpacing()
◆ tickLabel()
| const QwtText & QwtAbstractScaleDraw::tickLabel |
( |
const QFont & |
font, |
|
|
double |
value |
|
) |
| const |
|
protected |
Convert a value into its representing label and cache it.
The conversion between value and label is called very often in the layout and painting code. Unfortunately the calculation of the label sizes might be slow (really slow for rich text in Qt4), so it's necessary to cache the labels.
- Parameters
-
- Returns
- Tick label
◆ tickLength()
The documentation for this class was generated from the following files: