QtPdWidgets
2.3.1
|
#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... | |
Scale::Scale | ( | QWidget * | p, |
Orientation | o = Vertical |
||
) |
Constructor.
|
private |
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().
|
private |
|
inline |
References max.
Referenced by Pd::BarPrivate::calcPosition(), Pd::Graph::Layer::paint(), and Pd::BarPrivate::Stack::paintColorBar().
|
inline |
References min.
Referenced by Pd::BarPrivate::calcPosition(), Pd::Graph::Layer::paint(), and Pd::BarPrivate::Stack::paintColorBar().
|
inline |
References orientation.
|
inline |
References outerLength.
Referenced by Pd::Graph::Impl::updateBackground(), and Pd::BarPrivate::updateLayout().
|
inline |
void Scale::resetSuffix | ( | ) |
Resets the suffix to display after each value step.
References DEFAULT_SUFFIX, and setSuffix().
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().
void Scale::setMax | ( | double | max | ) |
Sets the scale value maximum (max).
If the value changes, this re-calculates the scale layout.
Referenced by Pd::BarPrivate::BarPrivate().
void Scale::setMin | ( | double | min | ) |
Sets the scale value minimum (min).
If the value changes, this re-calculates the scale layout.
Referenced by Pd::BarPrivate::BarPrivate().
void Scale::setOrientation | ( | Orientation | o | ) |
Sets the orientation.
If the value changes, this re-calculates the scale layout.
References orientation, and update().
void Scale::setSuffix | ( | const QString & | suffix | ) |
Sets the suffix to display after each value step.
References suffix, and update().
Referenced by resetSuffix().
void Scale::update | ( | ) |
Calculates the scale's layout.
References decade, formatValue(), Horizontal, length, majorStep, max, min, MIN_LINE_DIST, MIN_PX_HORIZONTAL, minorDiv, orientation, outerLength, parent, range(), and Vertical.
Referenced by setLength(), setMax(), setMin(), setOrientation(), setSuffix(), and Pd::BarPrivate::updateLayout().
|
private |
Decimal power.
Referenced by formatValue(), and update().
|
private |
Scale length in pixel.
Referenced by getLength(), setLength(), and update().
|
private |
|
private |
|
private |
|
private |
|
private |
Orientation.
Referenced by draw(), getOrientation(), setOrientation(), and update().
|
private |
Space for the numbering in pixel.
Referenced by draw(), getOuterLength(), and update().
|
private |
Suffix to display after each value step.
Referenced by formatValue(), getSuffix(), and setSuffix().