Qwt Programmer's Manual

QwtDblRange


NAME

QwtDblRange - A class which controls a value of type double within a closed interval

SYNOPSIS

#include <qwt_drange.h>

DESCRIPTION

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.

DERIVED CLASSES

QwtSliderBase, QwtCounter

PUBLIC MEMBERS

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

PROTECTED MEMBERS

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

QwtDblRange::QwtDblRange

Construct a QwtDblRange instance

Syntax

QwtDblRange::QwtDblRange()

Description

The range is initialized to [0.0, 100.0], the step size to 1.0, and the value to 0.0.

QwtDblRange::fitValue

Adjust the value to the closest point in the step raster.

Syntax

void QwtDblRange::fitValue(double x)

Parameters

double x
new value

Note

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.


QwtDblRange::setValue

Set a new value without adjusting to the step raster

Syntax

void QwtDblRange::setValue(double x)

Parameters

double x
new value

Note

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.


QwtDblRange::setRange

Specify range and step size

Syntax

void QwtDblRange::setRange(double vmin, double vmax, double vstep = 0, double pageSize = 0)

Parameters

double vmin
lower boundary of the interval
double vmax
higher boundary of the interval
double vstep
step width
int pageSize
page size in steps

Note


QwtDblRange::setStep

Change the step raster

Syntax

void QwtDblRange::setStep(double vstep)

Parameters

double vstep
new step width

Note

The value will not be adjusted to the new step raster.

QwtDblRange::setPeriodic

Make the range periodic

Syntax

void QwtDblRange::setPeriodic(bool tf)

Parameters

bool tf

Description

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.


QwtDblRange::incValue

Increment the value by a specified number of steps

Syntax

void QwtDblRange::incValue(int nSteps)

Parameters

int nSteps
Number of steps to increment

Note


QwtDblRange::incPages

Increment the value by a specified number of pages

Syntax

void QwtDblRange::incPages(int nPages)

Parameters

int nPages
Number of pages to increment. A negative number decrements the value.

Note

The Page size is specified in the constructor.

QwtDblRange::valueChange

Notify a change of value

Syntax

void QwtDblRange::valueChange()

Access

protected virtual

Description

This virtual function is called whenever the value changes. The default implementation does nothing.

QwtDblRange::rangeChange

Notify a change of the range

Syntax

void QwtDblRange::rangeChange()

Access

protected virtual

Description

This virtual function is called whenever the range changes. The default implementation does nothing.

QwtDblRange::stepChange

Notify a change of the step size

Syntax

void QwtDblRange::stepChange()

Access

protected virtual

Description

This virtual function is called whenever the step size changes. The default implementation does nothing.

QwtDblRange::value

Returns the current value

Syntax

double QwtDblRange::value()

QwtDblRange::pageSize

Returns the page size in steps.

Syntax

int QwtDblRange::pageSize() const

QwtDblRange::exactValue

Returns the exact value

Syntax

double QwtDblRange::exactValue()

Access

protected

Description

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.

QwtDblRange::prevValue

Returns the previous value

Access

protected

Syntax

double QwtDblRange::prevValue()

QwtDblRange::exactPrevValue

Returns the exact previous value

Syntax

double QwtDblRange::exactPrevValue()

Access

protected

Description

See exactValue

QwtDblRange::minValue

Returns the value at the first border of the range

Syntax

double QwtDblRange::minValue()

Description

minValue returns the value which has been specified as the first parameter in setRange.

See also

setRange

QwtDblRange::maxValue

Returns the value of the second border of the range

Syntax

double QwtDblRange::maxValue()

Description

maxValue returns the value which has been specified as the second parameter in setRange.

See also

setRange

QwtDblRange::periodic

Returns TRUE if the range is periodic

Syntax

bool QwtDblRange::periodic()

See also

setPeriodic

QwtDblRange::step

Returns the step size

Syntax

double QwtDblRange::step()

See also

setStep, setRange
Qwt Widget Library 01/01/98