Qwt User's Guide
svn
|
#include <qwt_double_range.h>
Inherited by QwtAbstractSlider, and QwtCounter.
Public Member Functions | |
virtual void | fitValue (double) |
virtual void | incPages (int) |
virtual void | incValue (int) |
bool | isValid () const |
double | maxValue () const |
double | minValue () const |
int | pageSize () const |
bool | periodic () const |
QwtDoubleRange () | |
void | setPeriodic (bool tf) |
void | setRange (double vmin, double vmax, double vstep=0.0, int pagesize=1) |
void | setStep (double) |
void | setValid (bool) |
virtual void | setValue (double) |
double | step () const |
double | value () const |
virtual | ~QwtDoubleRange () |
Protected Member Functions | |
double | exactPrevValue () const |
double | exactValue () const |
double | prevValue () const |
virtual void | rangeChange () |
virtual void | stepChange () |
virtual void | valueChange () |
A class which controls a value within an interval.
This class is useful as a base class or a member for sliders. It represents an interval of type double within which a value can be moved. The value can be either an arbitrary point inside the interval (see QwtDoubleRange::setValue), or it can be fitted into a step raster (see QwtDoubleRange::fitValue and QwtDoubleRange::incValue).
As a special case, a QwtDoubleRange can be periodic, which means that a value outside the interval will be mapped to a value inside the interval when QwtDoubleRange::setValue(), QwtDoubleRange::fitValue(), QwtDoubleRange::incValue() or QwtDoubleRange::incPages() are called.
QwtDoubleRange::QwtDoubleRange | ( | ) |
The range is initialized to [0.0, 100.0], the step size to 1.0, and the value to 0.0.
QwtDoubleRange::~QwtDoubleRange | ( | ) | [virtual] |
Destroys the QwtDoubleRange.
double QwtDoubleRange::exactPrevValue | ( | ) | const [protected] |
Returns the exact previous value.
double QwtDoubleRange::exactValue | ( | ) | const [protected] |
Returns the exact value.
The exact value is the value which QwtDoubleRange::value would return if the value were not adjusted to the step raster. It differs from the current value only if fitValue() or incValue() have been used before. This function is intended for internal use in derived classes.
void QwtDoubleRange::fitValue | ( | double | x | ) | [virtual] |
Adjust the value to the closest point in the step raster.
x | value |
new value := x + n * (max. value - min. value)
Reimplemented in QwtAbstractSlider.
void QwtDoubleRange::incPages | ( | int | nPages | ) | [virtual] |
Increment the value by a specified number of pages.
nPages | Number of pages to increment. A negative number decrements the value. |
void QwtDoubleRange::incValue | ( | int | nSteps | ) | [virtual] |
Increment the value by a specified number of steps.
nSteps | Number of steps to increment |
Reimplemented in QwtAbstractSlider.
bool QwtDoubleRange::isValid | ( | ) | const |
Indicates if the value is valid.
Reimplemented in QwtAbstractSlider.
double QwtDoubleRange::maxValue | ( | ) | const |
Returns the value of the second border of the range.
maxValue returns the value which has been specified as the second parameter in QwtDoubleRange::setRange.
Reimplemented in QwtCounter.
double QwtDoubleRange::minValue | ( | ) | const |
Returns the value at the first border of the range.
minValue returns the value which has been specified as the first parameter in setRange().
Reimplemented in QwtCounter.
int QwtDoubleRange::pageSize | ( | ) | const |
Returns the page size in steps.
bool QwtDoubleRange::periodic | ( | ) | const |
Returns true if the range is periodic.
double QwtDoubleRange::prevValue | ( | ) | const [protected] |
Returns the previous value.
void QwtDoubleRange::rangeChange | ( | ) | [protected, virtual] |
Notify a change of the range.
This virtual function is called whenever the range changes. The default implementation does nothing.
Reimplemented in QwtDial, QwtCounter, and QwtSlider.
void QwtDoubleRange::setPeriodic | ( | bool | tf | ) |
Make the range periodic.
When the range is periodic, the value will be set to a point inside the interval such that
point = value + n * width
if the user tries to set a new value which is outside the range. If the range is nonperiodic (the default), values outside the range will be clipped.
tf | true for a periodic range |
void QwtDoubleRange::setRange | ( | double | vmin, |
double | vmax, | ||
double | vstep = 0.0 , |
||
int | pageSize = 1 |
||
) |
Specify range and step size.
vmin | lower boundary of the interval |
vmax | higher boundary of the interval |
vstep | step width |
pageSize | page size in steps |
void QwtDoubleRange::setStep | ( | double | vstep | ) |
Change the step raster.
vstep | new step width |
Reimplemented in QwtCounter.
void QwtDoubleRange::setValid | ( | bool | isValid | ) |
Set the value to be valid/invalid.
Reimplemented in QwtAbstractSlider.
void QwtDoubleRange::setValue | ( | double | x | ) | [virtual] |
Set a new value without adjusting to the step raster.
x | new value |
new value := x + n * (max. value - min. value)
Reimplemented in QwtAbstractSlider, and QwtCounter.
double QwtDoubleRange::step | ( | ) | const |
void QwtDoubleRange::stepChange | ( | ) | [protected, virtual] |
Notify a change of the step size.
This virtual function is called whenever the step size changes. The default implementation does nothing.
double QwtDoubleRange::value | ( | ) | const |
Returns the current value.
Reimplemented in QwtCounter.
void QwtDoubleRange::valueChange | ( | ) | [protected, virtual] |
Notify a change of value.
This virtual function is called whenever the value changes. The default implementation does nothing.
Reimplemented in QwtDial, QwtAbstractSlider, QwtSlider, and QwtWheel.