QWT 7.0.1
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
QwtScaleDiv Class Reference

A class representing a scale division/表示刻度划分的类 More...

#include <qwt_scale_div.h>

Public Types

enum  TickType {
  NoTick = -1 , MinorTick , MediumTick , MajorTick ,
  NTickTypes
}
 Scale tick types. More...
 

Public Member Functions

 QwtScaleDiv (double lowerBound=0.0, double upperBound=0.0)
 Construct a division without ticks.
 
 QwtScaleDiv (const QwtInterval &, QList< double >[NTickTypes])
 Construct a scale division.
 
 QwtScaleDiv (double lowerBound, double upperBound, QList< double >[NTickTypes])
 Construct a scale division.
 
 QwtScaleDiv (double lowerBound, double upperBound, const QList< double > &minorTicks, const QList< double > &mediumTicks, const QList< double > &majorTicks)
 Construct a scale division.
 
bool operator== (const QwtScaleDiv &) const
 Equality operator.
 
bool operator!= (const QwtScaleDiv &) const
 Inequality.
 
bool fuzzyCompare (const QwtScaleDiv &other) const
 
void setInterval (double lowerBound, double upperBound)
 Change the interval.
 
void setInterval (const QwtInterval &)
 Change the interval.
 
QwtInterval interval () const
 
void setLowerBound (double)
 Set the first boundary.
 
double lowerBound () const
 
void setUpperBound (double)
 Set the second boundary.
 
double upperBound () const
 
double range () const
 
bool contains (double value) const
 Return if a value is between lowerBound() and upperBound()
 
void setTicks (int tickType, const QList< double > &)
 Assign ticks.
 
QList< double > ticks (int tickType) const
 Return a list of ticks.
 
bool isEmpty () const
 Check if the scale division is empty( lowerBound() == upperBound() )
 
bool isIncreasing () const
 Check if the scale division is increasing( lowerBound() <= upperBound() )
 
void invert ()
 Invert the scale division.
 
QwtScaleDiv inverted () const
 
QwtScaleDiv bounded (double lowerBound, double upperBound) const
 Return a scale division with an interval [lowerBound, upperBound] where all ticks outside this interval are removed.
 

Detailed Description

A class representing a scale division/表示刻度划分的类

A Qwt scale is defined by its boundaries and 3 list for the positions of the major, medium and minor ticks.

The upperBound() might be smaller than the lowerBound() to indicate inverted scales.

Scale divisions can be calculated from a QwtScaleEngine.

Qwt 刻度由其边界以及分别表示主刻度、中刻度和次刻度位置的三个列表定义。

upperBound() 可能小于 lowerBound(),以此表示刻度是反向的。

刻度划分可通过 QwtScaleEngine 计算得出。

See also
QwtScaleEngine::divideScale(), QwtPlot::setAxisScaleDiv(), QwtAbstractSlider::setScaleDiv()

Member Enumeration Documentation

◆ TickType

Scale tick types.

Enumerator
NoTick 

No ticks.

MinorTick 

Minor ticks.

MediumTick 

Medium ticks.

MajorTick 

Major ticks.

NTickTypes 

Number of valid tick types.

Constructor & Destructor Documentation

◆ QwtScaleDiv() [1/4]

QwtScaleDiv::QwtScaleDiv ( double  lowerBound = 0.0,
double  upperBound = 0.0 
)
explicit

Construct a division without ticks.

Parameters
lowerBoundFirst boundary
upperBoundSecond boundary
Note
lowerBound might be greater than upperBound for inverted scales

◆ QwtScaleDiv() [2/4]

QwtScaleDiv::QwtScaleDiv ( const QwtInterval interval,
QList< double >  ticks[NTickTypes] 
)
explicit

Construct a scale division.

Parameters
intervalInterval
ticksList of major, medium and minor ticks

◆ QwtScaleDiv() [3/4]

QwtScaleDiv::QwtScaleDiv ( double  lowerBound,
double  upperBound,
QList< double >  ticks[NTickTypes] 
)
explicit

Construct a scale division.

Parameters
lowerBoundFirst boundary
upperBoundSecond boundary
ticksList of major, medium and minor ticks
Note
lowerBound might be greater than upperBound for inverted scales

◆ QwtScaleDiv() [4/4]

QwtScaleDiv::QwtScaleDiv ( double  lowerBound,
double  upperBound,
const QList< double > &  minorTicks,
const QList< double > &  mediumTicks,
const QList< double > &  majorTicks 
)
explicit

Construct a scale division.

Parameters
lowerBoundFirst boundary
upperBoundSecond boundary
minorTicksList of minor ticks
mediumTicksList medium ticks
majorTicksList of major ticks
Note
lowerBound might be greater than upperBound for inverted scales

Member Function Documentation

◆ bounded()

QwtScaleDiv QwtScaleDiv::bounded ( double  lowerBound,
double  upperBound 
) const

Return a scale division with an interval [lowerBound, upperBound] where all ticks outside this interval are removed.

Parameters
lowerBoundLower bound
upperBoundUpper bound
Returns
Scale division with all ticks inside of the given interval
Note
lowerBound might be greater than upperBound for inverted scales

◆ contains()

bool QwtScaleDiv::contains ( double  value) const

Return if a value is between lowerBound() and upperBound()

Parameters
valueValue
Returns
true/false

◆ interval()

QwtInterval QwtScaleDiv::interval ( ) const
Returns
lowerBound -> upperBound

◆ invert()

void QwtScaleDiv::invert ( )

Invert the scale division.

See also
inverted()

◆ inverted()

QwtScaleDiv QwtScaleDiv::inverted ( ) const
Returns
A scale division with inverted boundaries and ticks
See also
invert()

◆ lowerBound()

double QwtScaleDiv::lowerBound ( ) const
Returns
First boundary
See also
upperBound()

◆ operator!=()

bool QwtScaleDiv::operator!= ( const QwtScaleDiv other) const

Inequality.

Returns
true if this instance is not equal to other

◆ operator==()

bool QwtScaleDiv::operator== ( const QwtScaleDiv other) const

Equality operator.

Returns
true if this instance is equal to other

◆ range()

double QwtScaleDiv::range ( ) const

◆ setInterval() [1/2]

void QwtScaleDiv::setInterval ( const QwtInterval interval)

Change the interval.

Parameters
intervalInterval

◆ setInterval() [2/2]

void QwtScaleDiv::setInterval ( double  lowerBound,
double  upperBound 
)

Change the interval.

Parameters
lowerBoundFirst boundary
upperBoundSecond boundary
Note
lowerBound might be greater than upperBound for inverted scales

◆ setLowerBound()

void QwtScaleDiv::setLowerBound ( double  lowerBound)

Set the first boundary.

Parameters
lowerBoundFirst boundary
See also
lowerBound(), setUpperBound()

◆ setTicks()

void QwtScaleDiv::setTicks ( int  tickType,
const QList< double > &  ticks 
)

Assign ticks.

Parameters
tickTypeMinorTick, MediumTick or MajorTick
ticksValues of the tick positions

◆ setUpperBound()

void QwtScaleDiv::setUpperBound ( double  upperBound)

Set the second boundary.

Parameters
upperBoundSecond boundary
See also
upperBound(), setLowerBound()

◆ ticks()

QList< double > QwtScaleDiv::ticks ( int  tickType) const

Return a list of ticks.

Parameters
tickTypeMinorTick, MediumTick or MajorTick
Returns
Tick list

◆ upperBound()

double QwtScaleDiv::upperBound ( ) const
Returns
upper bound
See also
lowerBound()

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