An abstract base class for drawing scales
更多...
#include <qwt_abstract_scale_draw.h>
|
| virtual void | drawTick (QPainter *painter, double value, double len) const =0 |
| |
| virtual void | drawBackbone (QPainter *painter) const =0 |
| |
| virtual void | drawLabel (QPainter *painter, double value) const =0 |
| |
| const QwtText & | tickLabel (const QFont &, double value) const |
| | Convert a value into its representing label and cache it
|
| |
An 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
◆ QwtAbstractScaleDraw()
| QwtAbstractScaleDraw::QwtAbstractScaleDraw |
( |
| ) |
|
Constructor for QwtAbstractScaleDraw
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.
Destructor for QwtAbstractScaleDraw
◆ draw()
| void QwtAbstractScaleDraw::draw |
( |
QPainter * |
painter, |
|
|
const QPalette & |
palette |
|
) |
| const |
|
virtual |
Draw the scale
- 参数
-
| 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 |
|
) |
| |
Enable or disable a scale component
- 参数
-
| component | Scale component (Backbone, Ticks, or Labels) |
| enable | True to enable, false to disable |
- 参见
- 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
- 参数
-
- 返回
- True if component is enabled
- 参见
- enableComponent()
◆ invalidateCache()
| void QwtAbstractScaleDraw::invalidateCache |
( |
| ) |
|
◆ isSelected()
| bool QwtAbstractScaleDraw::isSelected |
( |
| ) |
const |
Check if the scale draw is selected
- 返回
- True if selected, false otherwise
◆ 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.
- 参数
-
- 返回
- Label string
被 QwtCompassScaleDraw , 以及 QwtDateScaleDraw 重载.
◆ maxTickLength()
| double QwtAbstractScaleDraw::maxTickLength |
( |
| ) |
const |
◆ minimumExtent()
| double QwtAbstractScaleDraw::minimumExtent |
( |
| ) |
const |
◆ penWidthF()
| qreal QwtAbstractScaleDraw::penWidthF |
( |
| ) |
const |
Get the scale pen width
- 返回
- Scale pen width
- 参见
- setPenWidth()
◆ scaleDiv()
| const QwtScaleDiv & QwtAbstractScaleDraw::scaleDiv |
( |
| ) |
const |
Return the scale division
- 返回
- Current scale division object
◆ scaleMap() [1/2]
Return the scale map (non-const version)
- 返回
- Map for translating between scale and pixel values
◆ scaleMap() [2/2]
| const QwtScaleMap & QwtAbstractScaleDraw::scaleMap |
( |
| ) |
const |
Return the scale map (const version)
- 返回
- Map for translating between scale and pixel values
◆ selectedPenWidthOffset()
| qreal QwtAbstractScaleDraw::selectedPenWidthOffset |
( |
| ) |
const |
Get the current pen width offset for the axis when it is in selected state
- 返回
- The current width offset value
- 参见
- setSelectedPenWidthOffset()
◆ 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 (e.g., scrolling a scale), setting an upper limit as minimum extent will avoid jumps of the layout.
- 参数
-
- 参见
- extent(), minimumExtent()
◆ setPenWidthF()
| void QwtAbstractScaleDraw::setPenWidthF |
( |
qreal |
width | ) |
|
Specify the width of the scale pen
- 参数
-
- 参见
- penWidth()
◆ setScaleDiv()
| void QwtAbstractScaleDraw::setScaleDiv |
( |
const QwtScaleDiv & |
scaleDiv | ) |
|
Set the scale division
- 参数
-
| scaleDiv | New scale division object |
This also updates the scale map and clears the label cache.
◆ setSelected()
| void QwtAbstractScaleDraw::setSelected |
( |
bool |
on | ) |
|
Set whether the scale draw is selected
- 参数
-
| on | True to select, false to deselect |
◆ setSelectedPenWidthOffset()
| void QwtAbstractScaleDraw::setSelectedPenWidthOffset |
( |
qreal |
offset = 1 | ) |
|
Set the pen width offset for the axis when it is in selected state
When an axis (e.g., X-axis or Y-axis) is selected by the user, the pen width used for drawing will be increased by this offset value, achieving a visual highlighting effect.
- 参数
-
| offset | The additional width value to be added when selected (unit: pixels). This value should be non-negative. If it is 0, the line width in selected state will be the same as in normal state. |
- 参见
- 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.
- 参数
-
- 参见
- spacing()
◆ setTickLength()
Set the length of the ticks
- 参数
-
| tickType | Tick type |
| length | New length |
- 警告
- The length is limited to [0..1000]
◆ setTransformation()
| void QwtAbstractScaleDraw::setTransformation |
( |
QwtTransform * |
transformation | ) |
|
Set the scale transformation
- 参数
-
| transformation | New scale transformation object |
◆ spacing()
| double QwtAbstractScaleDraw::spacing |
( |
| ) |
const |
Get the spacing
The spacing is the distance between ticks and labels. The default spacing is 4 pixels.
- 返回
- Spacing
- 参见
- 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.
- 参数
-
- 返回
- Tick label
◆ tickLength()
该类的文档由以下文件生成: