QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
Classes | Public Member Functions | Protected Member Functions | Properties | 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:
QwtAbstractSlider QwtThermo QwtDial QwtKnob QwtSlider QwtAnalogClock QwtCompass

Classes

class  PrivateData
 

Public Member Functions

 QwtAbstractScale (QWidget *parent=nullptr)
 Constructor for QwtAbstractScale.
 
void setScale (double lowerBound, double upperBound)
 Specify a scale by interval bounds.
 
void setScale (const QwtInterval &)
 Specify a scale by interval.
 
void setScale (const QwtScaleDiv &)
 Specify a scale by scale division.
 
const QwtScaleDivscaleDiv () const
 Return the scale division.
 
void setLowerBound (double value)
 Set the lower bound of the scale.
 
double lowerBound () const
 Return the lower bound of the scale.
 
void setUpperBound (double value)
 Set the upper bound of the scale.
 
double upperBound () const
 Return the upper bound of the scale.
 
void setScaleStepSize (double stepSize)
 Set the step size used for calculating scale division.
 
double scaleStepSize () const
 Return the step size hint.
 
void setScaleMaxMajor (int ticks)
 Set the maximum number of major tick intervals.
 
int scaleMaxMinor () const
 Return the maximum number of minor tick intervals.
 
void setScaleMaxMinor (int ticks)
 Set the maximum number of minor tick intervals.
 
int scaleMaxMajor () const
 Return the maximum number of major tick intervals.
 
void setScaleEngine (QwtScaleEngine *)
 Set the scale engine.
 
const QwtScaleEnginescaleEngine () const
 Return the scale engine (const version)
 
QwtScaleEnginescaleEngine ()
 Return the scale engine (non-const version)
 
int transform (double) const
 Transform a scale value to widget coordinates.
 
double invTransform (int) const
 Transform a widget coordinate to scale value.
 
bool isInverted () const
 Check if scale is inverted.
 
double minimum () const
 Return the minimum boundary.
 
double maximum () const
 Return the maximum boundary.
 
const QwtScaleMapscaleMap () const
 Return the scale map.
 

Protected Member Functions

virtual void changeEvent (QEvent *) override
 Handle change events (English only)
 
void rescale (double lowerBound, double upperBound, double stepSize)
 Recalculate scale and update scale draw (English only)
 
void setAbstractScaleDraw (QwtAbstractScaleDraw *)
 Set the scale draw object (English only)
 
const QwtAbstractScaleDrawabstractScaleDraw () const
 Return the scale draw (const version) (English only)
 
QwtAbstractScaleDrawabstractScaleDraw ()
 Return the scale draw (non-const version) (English only)
 
void updateScaleDraw ()
 Update the scale draw (English only)
 
virtual void scaleChange ()
 Notify about scale changes (English only)
 

Properties

double lowerBound
 
double upperBound
 
int scaleMaxMajor
 
int scaleMaxMinor
 
double scaleStepSize
 

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::QwtAbstractScale ( QWidget *  parent = nullptr)
explicit

Constructor for QwtAbstractScale.

Parameters
parentParent 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 scaleMaxMinor to 3.

Destructor for QwtAbstractScale

Member Function Documentation

◆ abstractScaleDraw() [1/2]

QwtAbstractScaleDraw * QwtAbstractScale::abstractScaleDraw ( )
protected

Return the scale draw (non-const version) (English only)

Return the scale draw object (non-const)

Returns
Scale draw object
See also
setAbstractScaleDraw()

◆ abstractScaleDraw() [2/2]

const QwtAbstractScaleDraw * QwtAbstractScale::abstractScaleDraw ( ) const
protected

Return the scale draw (const version) (English only)

Return the scale draw object (const)

Returns
Scale draw object
See also
setAbstractScaleDraw()

◆ changeEvent()

void QwtAbstractScale::changeEvent ( QEvent *  event)
overrideprotectedvirtual

Handle change events (English only)

Handle change events.

Parameters
eventChange event

Invalidates internal caches if necessary (e.g., on locale change).

Reimplemented in QwtDial, QwtKnob, QwtSlider, and QwtThermo.

◆ invTransform()

double QwtAbstractScale::invTransform ( int  value) const

Transform a widget coordinate to scale value.

Parameters
valueWidget coordinate
Returns
Corresponding scale coordinate for value
See also
scaleMap(), transform()

◆ isInverted()

bool QwtAbstractScale::isInverted ( ) const

Check if scale is inverted.

Returns
True if scale is increasing in opposite direction to widget coordinates

◆ lowerBound()

double QwtAbstractScale::lowerBound ( ) const

Return the lower bound of the scale.

Returns
Lower bound value
See also
setLowerBound(), setScale(), upperBound()

◆ maximum()

double QwtAbstractScale::maximum ( ) const

Return the maximum boundary.

Returns
The boundary with the larger value
See also
minimum(), lowerBound(), upperBound()

◆ minimum()

double QwtAbstractScale::minimum ( ) const

Return the minimum boundary.

Returns
The boundary with the smaller value
See also
maximum(), lowerBound(), upperBound()

◆ rescale()

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

Recalculate scale and update scale draw (English only)

Recalculate scale division and update scale.

Parameters
lowerBoundLower limit of the scale interval
upperBoundUpper limit of the scale interval
stepSizeMajor step size
See also
scaleChange()

◆ scaleChange()

void QwtAbstractScale::scaleChange ( )
protectedvirtual

Notify about scale changes (English only)

Notify about scale changes.

This virtual function is called when the scale changes. Override this function in derived classes to handle scale changes.

Reimplemented in QwtAbstractSlider, QwtDial, QwtSlider, and QwtThermo.

◆ scaleDiv()

const QwtScaleDiv & QwtAbstractScale::scaleDiv ( ) const

Return the scale division.

Returns
Scale boundaries and positions of the ticks

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

◆ scaleEngine() [1/2]

QwtScaleEngine * QwtAbstractScale::scaleEngine ( )

Return the scale engine (non-const version)

Returns
Scale engine object
See also
setScaleEngine()

◆ scaleEngine() [2/2]

const QwtScaleEngine * QwtAbstractScale::scaleEngine ( ) const

Return the scale engine (const version)

Returns
Scale engine object
See also
setScaleEngine()

◆ scaleMap()

const QwtScaleMap & QwtAbstractScale::scaleMap ( ) const

Return the scale map.

Returns
Map to translate between scale and widget coordinates

◆ scaleMaxMajor()

int QwtAbstractScale::scaleMaxMajor ( ) const

Return the maximum number of major tick intervals.

Returns
Maximal number of major tick intervals
See also
setScaleMaxMajor(), scaleMaxMinor()

◆ scaleMaxMinor()

int QwtAbstractScale::scaleMaxMinor ( ) const

Return the maximum number of minor tick intervals.

Returns
Maximal number of minor tick intervals
See also
setScaleMaxMinor(), scaleMaxMajor()

◆ scaleStepSize()

double QwtAbstractScale::scaleStepSize ( ) const

Return the step size hint.

Returns
Hint for the step size of the scale
See also
setScaleStepSize(), QwtScaleEngine::divideScale()

◆ setAbstractScaleDraw()

void QwtAbstractScale::setAbstractScaleDraw ( QwtAbstractScaleDraw scaleDraw)
protected

Set the scale draw object (English only)

Set the scale draw object.

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

See also
abstractScaleDraw()

◆ setLowerBound()

void QwtAbstractScale::setLowerBound ( double  value)

Set the lower bound of the scale.

Parameters
valueLower bound value
See also
lowerBound(), setScale(), setUpperBound()
Note
For inverted scales, the lower bound is greater than the upper bound

◆ setScale() [1/3]

void QwtAbstractScale::setScale ( const QwtInterval interval)

Specify a scale by interval.

Define a scale by an interval. The ticks are calculated using scaleMaxMinor(), scaleMaxMajor() and scaleStepSize().

Parameters
intervalInterval object

◆ setScale() [2/3]

void QwtAbstractScale::setScale ( const QwtScaleDiv scaleDiv)

Specify a scale by scale division.

When using this method, scaleMaxMinor(), scaleMaxMajor() and scaleStepSize() have no effect.

Parameters
scaleDivScale division object
See also
setAutoScale()

◆ setScale() [3/3]

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

Specify a scale by interval bounds.

Define a scale by an interval. The ticks are calculated using scaleMaxMinor(), scaleMaxMajor() and scaleStepSize().

Parameters
lowerBoundLower limit of the scale interval
upperBoundUpper limit of the scale interval
Note
For inverted scales, the lower bound is greater than the upper bound

◆ setScaleEngine()

void QwtAbstractScale::setScaleEngine ( QwtScaleEngine scaleEngine)

Set the scale engine.

The scale engine is responsible for calculating the scale division and provides a transformation between scale and widget coordinates. scaleEngine must be created with new and will be deleted in the destructor or the next call of setScaleEngine().

Parameters
scaleEngineScale engine object

◆ setScaleMaxMajor()

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
ticksMaximal number of major ticks
See also
scaleMaxMajor(), setScaleMaxMinor(), setScaleStepSize(), QwtScaleEngine::divideInterval()

◆ setScaleMaxMinor()

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
ticksMaximal number of minor ticks
See also
scaleMaxMajor(), setScaleMaxMinor(), setScaleStepSize(), QwtScaleEngine::divideInterval()

◆ setScaleStepSize()

void QwtAbstractScale::setScaleStepSize ( double  stepSize)

Set the step size used for calculating scale division.

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

Parameters
stepSizeHint for the step size of the scale
See also
scaleStepSize(), QwtScaleEngine::divideScale()
Note
Position and distance between major ticks also depends on scaleMaxMajor()

◆ setUpperBound()

void QwtAbstractScale::setUpperBound ( double  value)

Set the upper bound of the scale.

Parameters
valueUpper bound value
See also
upperBound(), setScale(), setLowerBound()
Note
For inverted scales, the lower bound is greater than the upper bound

◆ transform()

int QwtAbstractScale::transform ( double  value) const

Transform a scale value to widget coordinates.

Parameters
valueScale value
Returns
Corresponding widget coordinate for value
See also
scaleMap(), invTransform()

◆ updateScaleDraw()

void QwtAbstractScale::updateScaleDraw ( )
protected

Update the scale draw (English only)

Recalculate ticks and scale boundaries.

Updates the scale draw by recalculating ticks and boundaries based on the current scale division.

◆ upperBound()

double QwtAbstractScale::upperBound ( ) const

Return the upper bound of the scale.

Returns
Upper bound value
See also
setUpperBound(), setScale(), lowerBound()

The documentation for this class was generated from the following files: