Qwt Programmer's Manual
QwtDblRange
QwtDblRange - A class which controls a value of type double within a
closed interval
#include <qwt_drange.h>
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 setValue), or it can be fitted
into a step raster (see fitValue and
incValue).
As a special case, a QwtDblRange can be periodic, which means that
a value outside the interval will be mapped to a value inside the
interval when setValue, fitValue,
incValue or incPages are called.
QwtSliderBase,
QwtCounter
- QwtDblRange
- Constructor
- fitValue
- Set value with raster fitting
- incValue
- Increments the value
- incPages
- Increments the value pagewise
- setPeriodic
- Make the range periodic
- setRange
- Specify range and step size
- setStep
- Change step size
- setValue
- Set value, no raster fitting
- maxValue
- Returns the upper boundary
- minValue
- Returns the lower boundary
- periodic
- Returns the TRUE if periodic
- step
- Returns the step size
- pageSize
- Returns the page size
- value
- Returns the value
- exactValue
- Returns the exact value
- exactPrevValue
- Returns the exact previous value
- prevValue
- Returns the previous value
- valueChange
- Called when the value has changed
- stepChange
- Called when the step size has changed
- rangeChange
- Called when the range has changed
Construct a QwtDblRange instance
QwtDblRange::QwtDblRange()
The range is initialized to [0.0, 100.0], the
step size to 1.0, and the value to 0.0.
Adjust the value to the closest point in the step
raster.
void QwtDblRange::fitValue(double x)
- double x
- new value
The value is clipped when it lies outside the range.
When the range is periodic, it will
be mapped to a point in the interval such that
new value := x + n * (max. value - min. value)
with an integer number n.
Set a new value without adjusting to the step raster
void QwtDblRange::setValue(double x)
- double x
- new value
The value is clipped when it lies outside the range.
When the range is periodic, it will
be mapped to a point in the interval such that
new value := x + n * (max. value - min. value)
with an integer number n.
Specify range and step size
void QwtDblRange::setRange(double vmin, double vmax, double vstep = 0, double pageSize = 0)
- double vmin
- lower boundary of the interval
- double vmax
- higher boundary of the interval
- double vstep
- step width
- int pageSize
- page size in steps
- A change of the range changes the value if it lies outside the
new range. The current value
will not be adjusted to the new step raster.
- vmax < vmin is allowed.
- If the step size is left out or set to zero, it will be
set to 1/100 of the interval length.
- If the step size has an absurd value, it will be corrected
to a better one.
Change the step raster
void QwtDblRange::setStep(double vstep)
- double vstep
- new step width
The value will not be adjusted to the new step raster.
Make the range periodic
void QwtDblRange::setPeriodic(bool tf)
- bool tf
-
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.
Increment the value by a specified number of steps
void QwtDblRange::incValue(int nSteps)
- int nSteps
- Number of steps to increment
- As a result of this operation, the new value will always be
adjusted to the step raster.
Increment the value by a specified number of pages
void QwtDblRange::incPages(int nPages)
- int nPages
- Number of pages to increment.
A negative number decrements the value.
The Page size is specified in the constructor.
Notify a change of value
void QwtDblRange::valueChange()
protected virtual
This virtual function is called whenever the value changes.
The default implementation does nothing.
Notify a change of the range
void QwtDblRange::rangeChange()
protected virtual
This virtual function is called whenever the range changes.
The default implementation does nothing.
Notify a change of the step size
void QwtDblRange::stepChange()
protected virtual
This virtual function is called whenever the step size changes.
The default implementation does nothing.
Returns the current value
double QwtDblRange::value()
Returns the page size in steps.
int QwtDblRange::pageSize() const
Returns the exact value
double QwtDblRange::exactValue()
protected
The exact value is the value which 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.
Returns the previous value
protected
double QwtDblRange::prevValue()
Returns the exact previous value
double QwtDblRange::exactPrevValue()
protected
See exactValue
Returns the value at the first border of the range
double QwtDblRange::minValue()
minValue returns the value which has been specified
as the first parameter in setRange.
setRange
Returns the value of the second border of the range
double QwtDblRange::maxValue()
maxValue returns the value which has been specified
as the second parameter in setRange.
setRange
Returns TRUE if the range is periodic
bool QwtDblRange::periodic()
setPeriodic
Returns the step size
double QwtDblRange::step()
setStep, setRange
Qwt Widget Library 01/01/98