Qwt User's Guide 6.1.0

- Main Page
- Related Pages
- Classes

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Functions Variables Typedefs Enumerations Enumerator Pages
Public Member Functions | Protected Member Functions | List of all members
QwtAbstractScale Class Reference

An abstract base class for widgets having a scale. More...

`#include <qwt_abstract_scale.h>`

Inheritance diagram for QwtAbstractScale:
[legend]

## Public Member Functions
| QwtAbstractScale (QWidget *parent=NULL)
virtual | ~QwtAbstractScale ()
| Destructor.
void | setScale (double lowerBound, double upperBound)
| Specify a scale. More...
void | setScale (const QwtInterval &)
| Specify a scale. More...
void | setScale (const QwtScaleDiv &)
| Specify a scale. More...
const QwtScaleDiv & | scaleDiv () const
void | setLowerBound (double value)
double | lowerBound () const
void | setUpperBound (double value)
double | upperBound () const
void | setScaleStepSize (double stepSize)
| Set the step size used for calculating a scale division. More...
double | scaleStepSize () const
void | setScaleMaxMajor (int ticks)
| Set the maximum number of major tick intervals. More...
int | scaleMaxMinor () const
void | setScaleMaxMinor (int ticks)
| Set the maximum number of minor tick intervals. More...
int | scaleMaxMajor () const
void | setScaleEngine (QwtScaleEngine *)
| Set a scale engine. More...
const QwtScaleEngine * | scaleEngine () const
QwtScaleEngine * | scaleEngine ()
int | transform (double) const
double | invTransform (int) const
bool | isInverted () const
double | minimum () const
double | maximum () const
const QwtScaleMap & | scaleMap () const

## Protected Member Functions
void | rescale (double lowerBound, double upperBound, double stepSize)
void | setAbstractScaleDraw (QwtAbstractScaleDraw *)
| Set a scale draw. More...
const QwtAbstractScaleDraw * | abstractScaleDraw () const
QwtAbstractScaleDraw * | abstractScaleDraw ()
virtual void | scaleChange ()
| Notify changed scale.

## Detailed Description

An abstract base class for widgets having a scale.

The scale of an QwtAbstractScale is determined by a QwtScaleDiv definition, that contains the boundaries and the ticks of the scale. The scale is painted using a QwtScaleDraw object.

The scale division might be assigned explicitly - but usually it is calculated from the boundaries using a QwtScaleEngine.

The scale engine also decides the type of transformation of the scale ( linear, logarithmic ... ).

## Constructor & Destructor Documentation

QwtAbstractScale::QwtAbstractScale | ( | QWidget * | parent = `NULL` | ) |

Constructor

Parameters

  parent | Parent widget

Creates a default QwtScaleDraw and a QwtLinearScaleEngine. The initial scale boundaries are set to [ 0.0, 100.0 ]

The scaleStepSize() is initialized to 0.0, scaleMaxMajor() to 5 and scaleMaxMajor to 3.

## Member Function Documentation

const QwtAbstractScaleDraw * QwtAbstractScale::abstractScaleDraw | ( |  | ) | const
| protected

Returns
  Scale draw

See Also
  setAbstractScaleDraw()

QwtAbstractScaleDraw * QwtAbstractScale::abstractScaleDraw | ( |  | ) |
| protected

Returns
  Scale draw

See Also
  setAbstractScaleDraw()

double QwtAbstractScale::invTransform | ( | int | value | ) | const

Translate a widget coordinate into a scale value

Parameters

  value | Widget coordinate

Returns
  Corresponding scale coordinate for value

See Also
  scaleMap(), transform()

bool QwtAbstractScale::isInverted | ( |  | ) | const

Returns
  True, when the scale is increasing in opposite direction to the widget coordinates

double QwtAbstractScale::lowerBound | ( |  | ) | const

Returns
  Lower bound of the scale

See Also
  setLowerBound(), setScale(), upperBound()

double QwtAbstractScale::maximum | ( |  | ) | const

Returns
  The boundary with the larger value

See Also
  minimum(), lowerBound(), upperBound()

double QwtAbstractScale::minimum | ( |  | ) | const

Returns
  The boundary with the smaller value

See Also
  maximum(), lowerBound(), upperBound()

void QwtAbstractScale::rescale | ( | double | lowerBound,
|  | double | upperBound,
|  | double | stepSize
| ) |  |
| protected

Recalculate the scale division and update the scale.

Parameters

  lowerBound | Lower limit of the scale interval
  upperBound | Upper limit of the scale interval
  stepSize | Major step size

See Also
  scaleChange()

const QwtScaleDiv & QwtAbstractScale::scaleDiv | ( |  | ) | const

Returns
  Scale boundaries and positions of the ticks

The scale division might have been assigned explicitly or calculated implicitly by rescale().

const QwtScaleEngine * QwtAbstractScale::scaleEngine | ( |  | ) | const

Returns
  Scale engine

See Also
  setScaleEngine()

QwtScaleEngine * QwtAbstractScale::scaleEngine | ( |  | ) |

Returns
  Scale engine

See Also
  setScaleEngine()

const QwtScaleMap & QwtAbstractScale::scaleMap | ( |  | ) | const

Returns
  Map to translate between scale and widget coordinates

int QwtAbstractScale::scaleMaxMajor | ( |  | ) | const

Returns
  Maximal number of major tick intervals

See Also
  setScaleMaxMajor(), scaleMaxMinor()

int QwtAbstractScale::scaleMaxMinor | ( |  | ) | const

Returns
  Maximal number of minor tick intervals

See Also
  setScaleMaxMinor(), scaleMaxMajor()

double QwtAbstractScale::scaleStepSize | ( |  | ) | const

Returns
  Hint for the step size of the scale

See Also
  setScaleStepSize(), QwtScaleEngine::divideScale()

void QwtAbstractScale::setAbstractScaleDraw | ( | QwtAbstractScaleDraw * | scaleDraw | ) |
| protected

Set a scale draw.

scaleDraw has to be created with new and will be deleted in the destructor or the next call of setAbstractScaleDraw().

See Also
  abstractScaleDraw()

void QwtAbstractScale::setLowerBound | ( | double | value | ) |

Set the lower bound of the scale

Parameters

  value | Lower bound

See Also
  lowerBound(), setScale(), setUpperBound()

Note
  For inverted scales the lower bound is greater than the upper bound

void QwtAbstractScale::setScale | ( | double | lowerBound,
|  | double | upperBound
| ) |  |

Specify a scale.

Define a scale by an interval

The ticks are calculated using scaleMaxMinor(), scaleMaxMajor() and scaleStepSize().

Parameters

  lowerBound | lower limit of the scale interval
  upperBound | upper limit of the scale interval

Note
  For inverted scales the lower bound is greater than the upper bound

void QwtAbstractScale::setScale | ( | const QwtInterval & | interval | ) |

Specify a scale.

Define a scale by an interval

The ticks are calculated using scaleMaxMinor(), scaleMaxMajor() and scaleStepSize().

Parameters

  interval | Interval

void QwtAbstractScale::setScale | ( | const QwtScaleDiv & | scaleDiv | ) |

Specify a scale.

scaleMaxMinor(), scaleMaxMajor() and scaleStepSize() and have no effect.

Parameters

  scaleDiv | Scale division

See Also
  setAutoScale()

void QwtAbstractScale::setScaleEngine | ( | QwtScaleEngine * | scaleEngine | ) |

Set a scale engine.

The scale engine is responsible for calculating the scale division and provides a transformation between scale and widget coordinates.

scaleEngine has to be created with new and will be deleted in the destructor or the next call of setScaleEngine.

void QwtAbstractScale::setScaleMaxMajor | ( | int | ticks | ) |

Set the maximum number of major tick intervals.

The scale's major ticks are calculated automatically such that the number of major intervals does not exceed ticks.

The default value is 5.

Parameters

  ticks | Maximal number of major ticks.

See Also
  scaleMaxMajor(), setScaleMaxMinor(), setScaleStepSize(), QwtScaleEngine::divideInterval()

void QwtAbstractScale::setScaleMaxMinor | ( | int | ticks | ) |

Set the maximum number of minor tick intervals.

The scale's minor ticks are calculated automatically such that the number of minor intervals does not exceed ticks. The default value is 3.

Parameters

  ticks | Maximal number of minor ticks.

See Also
  scaleMaxMajor(), setScaleMaxMinor(), setScaleStepSize(), QwtScaleEngine::divideInterval()

void QwtAbstractScale::setScaleStepSize | ( | double | stepSize | ) |

Set the step size used for calculating a scale division.

The step size is hint for calculating the intervals for the major ticks of the scale. A value of 0.0 is interpreted as no hint.

Parameters

  stepSize | Hint for the step size of the scale

See Also
  scaleStepSize(), QwtScaleEngine::divideScale()

Note
  Position and distance between the major ticks also depends on scaleMaxMajor().

void QwtAbstractScale::setUpperBound | ( | double | value | ) |

Set the upper bound of the scale

Parameters

  value | Upper bound

See Also
  upperBound(), setScale(), setLowerBound()

Note
  For inverted scales the lower bound is greater than the upper bound

int QwtAbstractScale::transform | ( | double | value | ) | const

Translate a scale value into a widget coordinate

Parameters

  value | Scale value

Returns
  Corresponding widget coordinate for value

See Also
  scaleMap(), invTransform()

double QwtAbstractScale::upperBound | ( |  | ) | const

Returns
  Upper bound of the scale

See Also
  setUpperBound(), setScale(), lowerBound()