#include <qwt_abstract_scale_draw.h>
List of all members.
Public Types |
enum | ScaleComponent {
Backbone = 1,
Ticks = 2,
Labels = 4
} |
Protected Member Functions |
virtual void | drawBackbone (QPainter *painter) const =0 |
virtual void | drawLabel (QPainter *painter, double value) const =0 |
virtual void | drawTick (QPainter *painter, double value, int len) const =0 |
void | invalidateCache () |
const QwtText & | tickLabel (const QFont &, double value) const |
Detailed Description
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 QwtAbstractScaleDraw::setScaleDiv(const QwtScaleDiv &s), the scale can be drawn with the QwtAbstractScaleDraw::draw() member.
Member Enumeration Documentation
Constructor & Destructor Documentation
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
Member Function Documentation
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 |
virtual void QwtAbstractScaleDraw::drawBackbone |
( |
QPainter * |
painter | ) |
const |
|
protectedpure virtual |
virtual void QwtAbstractScaleDraw::drawLabel |
( |
QPainter * |
painter, |
|
|
double |
value |
|
) |
| const |
|
protectedpure virtual |
virtual void QwtAbstractScaleDraw::drawTick |
( |
QPainter * |
painter, |
|
|
double |
value, |
|
|
int |
len |
|
) |
| const |
|
protectedpure virtual |
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()
virtual int QwtAbstractScaleDraw::extent |
( |
const QPen & |
, |
|
|
const QFont & |
|
|
) |
| const |
|
pure virtual |
bool QwtAbstractScaleDraw::hasComponent |
( |
ScaleComponent |
component | ) |
const |
void QwtAbstractScaleDraw::invalidateCache |
( |
| ) |
|
|
protected |
QwtText QwtAbstractScaleDraw::label |
( |
double |
value | ) |
const |
|
virtual |
Convert a value into its representing label.
The value is converted to a plain text using QLocale::system().toString(value). This method is often overloaded by applications to have individual labels.
- Parameters:
-
- Returns:
- Label string.
Reimplemented in QwtDialScaleDraw.
int QwtAbstractScaleDraw::majTickLength |
( |
| ) |
const |
The same as QwtAbstractScaleDraw::tickLength(QwtScaleDiv::MajorTick).
const QwtScaleMap & QwtAbstractScaleDraw::map |
( |
| ) |
const |
- Returns:
- Map how to translate between scale and pixel values
int QwtAbstractScaleDraw::minimumExtent |
( |
| ) |
const |
const QwtScaleDiv & QwtAbstractScaleDraw::scaleDiv |
( |
| ) |
const |
- Returns:
- Map how to translate between scale and pixel values
void QwtAbstractScaleDraw::setMinimumExtent |
( |
int |
minExtent | ) |
|
Set a minimum for the extent.
The extent is calculated from the coomponents 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()
void QwtAbstractScaleDraw::setScaleDiv |
( |
const QwtScaleDiv & |
sd | ) |
|
Change the scale division
- Parameters:
-
void QwtAbstractScaleDraw::setSpacing |
( |
int |
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()
Set the length of the ticks
- Parameters:
-
tickType | Tick type |
length | New length |
- Warning:
- the length is limited to [0..1000]
Change the transformation of the scale
- Parameters:
-
transformation | New scale transformation |
int QwtAbstractScaleDraw::spacing |
( |
| ) |
const |
Get the spacing.
The spacing is the distance between ticks and labels. The default spacing is 4 pixels.
- See also:
- setSpacing()
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