QtPdWidgets  2.3.1
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
Pd::Scale Class Reference

Scale. More...

#include <Scale.h>

Public Types

enum  Orientation { Vertical, Horizontal }
 Scale orientation. More...
 

Public Member Functions

 Scale (QWidget *, Orientation=Vertical)
 Constructor. More...
 
Orientation getOrientation () const
 
void setOrientation (Orientation)
 Sets the orientation. More...
 
double getMin () const
 
void setMin (double)
 Sets the scale value minimum (min). More...
 
double getMax () const
 
void setMax (double)
 Sets the scale value maximum (max). More...
 
int getLength () const
 
void setLength (int)
 Sets the scale length in pixel. More...
 
const QString & getSuffix () const
 
void setSuffix (const QString &)
 Sets the suffix to display after each value step. More...
 
void resetSuffix ()
 Resets the suffix to display after each value step. More...
 
void update ()
 Calculates the scale's layout. More...
 
double range () const
 
int getOuterLength () const
 
void draw (QPainter &, const QRect &, const QColor &, int=0) const
 Draws the scale into the given QRect with the given QPainter. More...
 

Private Member Functions

 Scale ()
 
QString formatValue (double) const
 Formats a numeric value. More...
 

Private Attributes

const QWidget *const parent
 Parent widget. More...
 
Orientation orientation
 Orientation. More...
 
double min
 Minimum value. More...
 
double max
 Maximum value. More...
 
int length
 Scale length in pixel. More...
 
QString suffix
 Suffix to display after each value step. More...
 
int outerLength
 Space for the numbering in pixel. More...
 
double majorStep
 The major division (long ticks). More...
 
unsigned int minorDiv
 The minor division (short ticks). More...
 
int decade
 Decimal power. More...
 

Detailed Description

Scale.

Member Enumeration Documentation

◆ Orientation

Scale orientation.

Enumerator
Vertical 

Scale is oriented vertically.

Horizontal 

Scale is oriented horizontally.

Constructor & Destructor Documentation

◆ Scale() [1/2]

Scale::Scale ( QWidget *  p,
Orientation  o = Vertical 
)

Constructor.

◆ Scale() [2/2]

Pd::Scale::Scale ( )
private

Member Function Documentation

◆ draw()

void Scale::draw ( QPainter &  painter,
const QRect &  rect,
const QColor &  ,
int  minLength = 0 
) const

Draws the scale into the given QRect with the given QPainter.

References formatValue(), Horizontal, majorStep, max, min, minorDiv, orientation, outerLength, parent, and range().

Referenced by Pd::BarPrivate::updateBackground(), and Pd::Graph::Impl::updateBackground().

◆ formatValue()

QString Scale::formatValue ( double  value) const
private

Formats a numeric value.

References decade, and suffix.

Referenced by draw(), and update().

◆ getLength()

int Pd::Scale::getLength ( ) const
inline
Returns
The length.

References length.

◆ getMax()

double Pd::Scale::getMax ( ) const
inline
Returns
The scale maximum value (max).

References max.

Referenced by Pd::BarPrivate::calcPosition(), Pd::Graph::Layer::paint(), and Pd::BarPrivate::Stack::paintColorBar().

◆ getMin()

double Pd::Scale::getMin ( ) const
inline
Returns
The scale minimum value (min).

References min.

Referenced by Pd::BarPrivate::calcPosition(), Pd::Graph::Layer::paint(), and Pd::BarPrivate::Stack::paintColorBar().

◆ getOrientation()

Scale::Orientation Pd::Scale::getOrientation ( ) const
inline
Returns
The orientation.

References orientation.

◆ getOuterLength()

int Pd::Scale::getOuterLength ( ) const
inline

◆ getSuffix()

const QString & Pd::Scale::getSuffix ( ) const
inline
Returns
The suffix.

References suffix.

◆ range()

double Pd::Scale::range ( ) const
inline
Returns
The value range (max - min).

References max, and min.

Referenced by Pd::BarPrivate::calcPosition(), draw(), and update().

◆ resetSuffix()

void Scale::resetSuffix ( )

Resets the suffix to display after each value step.

References DEFAULT_SUFFIX, and setSuffix().

◆ setLength()

void Scale::setLength ( int  length)

Sets the scale length in pixel.

If the value changes, this re-calculates the scale layout.

References length, and update().

Referenced by Pd::Graph::Impl::updateBackground(), and Pd::BarPrivate::updateLayout().

◆ setMax()

void Scale::setMax ( double  max)

Sets the scale value maximum (max).

If the value changes, this re-calculates the scale layout.

References max, and update().

Referenced by Pd::BarPrivate::BarPrivate().

◆ setMin()

void Scale::setMin ( double  min)

Sets the scale value minimum (min).

If the value changes, this re-calculates the scale layout.

References min, and update().

Referenced by Pd::BarPrivate::BarPrivate().

◆ setOrientation()

void Scale::setOrientation ( Orientation  o)

Sets the orientation.

If the value changes, this re-calculates the scale layout.

References orientation, and update().

◆ setSuffix()

void Scale::setSuffix ( const QString &  suffix)

Sets the suffix to display after each value step.

References suffix, and update().

Referenced by resetSuffix().

◆ update()

void Scale::update ( )

Member Data Documentation

◆ decade

int Pd::Scale::decade
private

Decimal power.

Referenced by formatValue(), and update().

◆ length

int Pd::Scale::length
private

Scale length in pixel.

Referenced by getLength(), setLength(), and update().

◆ majorStep

double Pd::Scale::majorStep
private

The major division (long ticks).

Referenced by draw(), and update().

◆ max

double Pd::Scale::max
private

Maximum value.

Referenced by draw(), getMax(), range(), setMax(), and update().

◆ min

double Pd::Scale::min
private

Minimum value.

Referenced by draw(), getMin(), range(), setMin(), and update().

◆ minorDiv

unsigned int Pd::Scale::minorDiv
private

The minor division (short ticks).

Referenced by draw(), and update().

◆ orientation

Orientation Pd::Scale::orientation
private

Orientation.

Referenced by draw(), getOrientation(), setOrientation(), and update().

◆ outerLength

int Pd::Scale::outerLength
private

Space for the numbering in pixel.

Referenced by draw(), getOuterLength(), and update().

◆ parent

const QWidget* const Pd::Scale::parent
private

Parent widget.

Referenced by draw(), and update().

◆ suffix

QString Pd::Scale::suffix
private

Suffix to display after each value step.

Referenced by formatValue(), getSuffix(), and setSuffix().


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