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

Time Scale. More...

#include <TimeScale.h>

Public Member Functions

 TimeScale (QWidget *)
 Constructor. More...
 
double getMin () const
 
void setMin (double)
 Sets the scale start time. More...
 
double getMax () const
 
void setMax (double)
 Sets the scale end time. More...
 
int getLength () const
 
void setLength (int)
 Sets the scale length in pixel. More...
 
void update ()
 Calculates the scale's layout. More...
 
int getOuterLength () const
 
void draw (QPainter &, const QRect &, const QColor &) const
 Draws the scale into the given QRect with the given QPainter. More...
 

Private Types

enum  Tics {
  Seconds, MinutesSeconds, Minutes, HoursMinutes,
  Hours
}
 

Private Member Functions

 TimeScale ()
 
QString formatValue (double) const
 Formats a numeric value. More...
 
void drawMajor (QPainter &, const QRect &, double, double, double, const QColor &, const QColor &) const
 Draws a major tick with a label. More...
 
void drawMinor (QPainter &, const QRect &, double, double, const QColor &) const
 Draws a minor tick. More...
 

Private Attributes

const QWidget *const parent
 Parent widget. More...
 
double min
 Minimum value. More...
 
double max
 Maximum value. More...
 
int length
 Scale length in pixel. More...
 
int outerLength
 Space for the numbering in pixel. More...
 
Tics tics
 
double majorStep
 The major division (long ticks). More...
 
unsigned int minorDiv
 The minor division (short ticks). More...
 
int subDigits
 

Detailed Description

Time Scale.

Member Enumeration Documentation

◆ Tics

enum Pd::TimeScale::Tics
private
Enumerator
Seconds 
MinutesSeconds 
Minutes 
HoursMinutes 
Hours 

Constructor & Destructor Documentation

◆ TimeScale() [1/2]

TimeScale::TimeScale ( QWidget *  p)

Constructor.

◆ TimeScale() [2/2]

Pd::TimeScale::TimeScale ( )
private

Member Function Documentation

◆ draw()

void TimeScale::draw ( QPainter &  painter,
const QRect &  rect,
const QColor &  gridColor 
) const

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

References drawMajor(), drawMinor(), majorStep, max, min, minorDiv, and parent.

Referenced by Pd::Graph::Impl::updateBackground().

◆ drawMajor()

void TimeScale::drawMajor ( QPainter &  painter,
const QRect &  rect,
double  scale,
double  t,
double  n,
const QColor &  gridColor,
const QColor &  foregroundColor 
) const
private

Draws a major tick with a label.

References formatValue(), and min.

Referenced by draw().

◆ drawMinor()

void TimeScale::drawMinor ( QPainter &  painter,
const QRect &  rect,
double  scale,
double  t,
const QColor &  gridColor 
) const
private

Draws a minor tick.

References min, and outerLength.

Referenced by draw().

◆ formatValue()

QString TimeScale::formatValue ( double  t) const
private

Formats a numeric value.

References Hours, HoursMinutes, Minutes, MinutesSeconds, Seconds, subDigits, and tics.

Referenced by drawMajor().

◆ getLength()

int Pd::TimeScale::getLength ( ) const
inline

References length.

Referenced by Pd::Graph::Impl::updateBackground().

◆ getMax()

double Pd::TimeScale::getMax ( ) const
inline

References max.

◆ getMin()

double Pd::TimeScale::getMin ( ) const
inline

References min.

◆ getOuterLength()

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

◆ setLength()

void TimeScale::setLength ( int  l)

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().

◆ setMax()

void TimeScale::setMax ( double  t)

Sets the scale end time.

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

References max, and update().

Referenced by Pd::Graph::Impl::updateTimeScale().

◆ setMin()

void TimeScale::setMin ( double  t)

Sets the scale start time.

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

References min, and update().

Referenced by Pd::Graph::Impl::updateTimeScale().

◆ update()

void TimeScale::update ( )

Calculates the scale's layout.

References Hours, HoursMinutes, length, majorStep, max, min, minorDiv, Minutes, MinutesSeconds, outerLength, parent, Seconds, subDigits, and tics.

Referenced by setLength(), setMax(), and setMin().

Member Data Documentation

◆ length

int Pd::TimeScale::length
private

Scale length in pixel.

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

◆ majorStep

double Pd::TimeScale::majorStep
private

The major division (long ticks).

Referenced by draw(), and update().

◆ max

double Pd::TimeScale::max
private

Maximum value.

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

◆ min

double Pd::TimeScale::min
private

Minimum value.

Referenced by draw(), drawMajor(), drawMinor(), getMin(), setMin(), and update().

◆ minorDiv

unsigned int Pd::TimeScale::minorDiv
private

The minor division (short ticks).

Referenced by draw(), and update().

◆ outerLength

int Pd::TimeScale::outerLength
private

Space for the numbering in pixel.

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

◆ parent

const QWidget* const Pd::TimeScale::parent
private

Parent widget.

Referenced by draw(), and update().

◆ subDigits

int Pd::TimeScale::subDigits
private

Referenced by formatValue(), and update().

◆ tics

Tics Pd::TimeScale::tics
private

Referenced by formatValue(), and update().


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