---
name: "QwtDblRange"
section: "3"
platform: "linux"
package: "libqwt-doc"
version: "4.2.0-6"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/QwtDblRange"
---

# QwtDblRange(3)

## NAME

QwtDblRange -

## SYNOPSIS

Inherited by **QwtCounter**, and **QwtSliderBase**.

## Detailed Description

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 **QwtDblRange::setValue**), or it can be fitted into a step raster (see **QwtDblRange::fitValue** and **QwtDblRange::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 **QwtDblRange::setValue()**, **QwtDblRange::fitValue()**, **QwtDblRange::incValue()** or **QwtDblRange::incPages()** are called.

Definition at line 31 of file qwt\_drange.h.

### Public Member Functions

**QwtDblRange** ()\
 virtual **~QwtDblRange** ()\
 void **setRange** (double vmin, double vmax, double vstep=0.0, int pagesize=1)\
 void **setValid** (bool)\
 bool **isValid** () const\
 virtual void **setValue** (double)\
 double **value** () const\
 void **setPeriodic** (bool tf)\
 bool **periodic** () const\
 void **setStep** (double)\
 double **step** () const\
 double **maxValue** () const\
 double **minValue** () const\
 int **pageSize** () const\
 virtual void **incValue** (int)\
 virtual void **incPages** (int)\
 virtual void **fitValue** (double)\

### Protected Member Functions

double **exactValue** () const\
 double **exactPrevValue** () const\
 double **prevValue** () const\
 virtual void **valueChange** ()\
 virtual void **stepChange** ()\
 virtual void **rangeChange** ()\

## Constructor & Destructor Documentation

### QwtDblRange::QwtDblRange ()

The range is initialized to \[0.0, 100.0\], the step size to 1.0, and the value to 0.0. Definition at line 21 of file qwt\_drange.cpp.

### QwtDblRange::~QwtDblRange ()` [virtual]`

Destroys the QwtDblRange.

Definition at line 36 of file qwt\_drange.cpp.

## Member Function Documentation

### double QwtDblRange::exactPrevValue () const` [protected]`

Returns the exact previous value.

Definition at line 380 of file qwt\_drange.cpp.

Referenced by QwtSliderBase::mouseMoveEvent().

### double QwtDblRange::exactValue () const` [protected]`

Returns the exact value.

The exact value is the value which **QwtDblRange::value** would return if the value were not adjusted to the step raster. It differs from the current value only if **QwtDblRange::fitValue** or **QwtDblRange::incValue** have been used before. This function is intended for internal use in derived classes. Definition at line 374 of file qwt\_drange.cpp.

Referenced by QwtSliderBase::mouseMoveEvent(), and QwtSliderBase::timerEvent().

### void QwtDblRange::fitValue (double x)` [virtual]`

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

**Parameters:**

*x* value

**Warning:**

The value is clipped when it lies outside the range. When the range is **QwtDblRange::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.

Reimplemented in **QwtSliderBase**.

Definition at line 132 of file qwt\_drange.cpp.

Referenced by QwtSliderBase::fitValue(), QwtSliderBase::mouseReleaseEvent(), QwtSliderBase::setPosition(), and QwtSliderBase::timerEvent().

### void QwtDblRange::incPages (int nPages)` [virtual]`

Increment the value by a specified number of pages.

**Parameters:**

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

**Warning:**

The Page size is specified in the constructor.

Definition at line 271 of file qwt\_drange.cpp.

References isValid().

Referenced by QwtSliderBase::mouseReleaseEvent(), QwtSliderBase::timerEvent(), and QwtSliderBase::wheelEvent().

### void QwtDblRange::incValue (int nSteps)` [virtual]`

Increment the value by a specified number of steps.

**Parameters:**

*nSteps* Number of steps to increment

**Warning:**

As a result of this operation, the new value will always be adjusted to the step raster.

Reimplemented in **QwtSliderBase**.

Definition at line 259 of file qwt\_drange.cpp.

References isValid().

Referenced by QwtSliderBase::incValue(), QwtSliderBase::keyPressEvent(), and QwtDial::keyPressEvent().

### bool QwtDblRange::isValid () const

Indicates if the value is valid.

Reimplemented in **QwtSliderBase**.

Definition at line 51 of file qwt\_drange.cpp.

Referenced by incPages(), incValue(), and QwtSliderBase::isValid().

### double QwtDblRange::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 **QwtDblRange::setRange**.

**See also:**

**QwtDblRange::setRange()**

Definition at line 326 of file qwt\_drange.cpp.

Referenced by QwtDial::drawContents(), QwtWheel::drawWheel(), QwtWheel::getValue(), QwtSlider::getValue(), QwtDial::getValue(), QwtDial::keyPressEvent(), QwtCounter::maxVal(), QwtSlider::rangeChange(), QwtSlider::scaleChange(), QwtCounter::setMinValue(), QwtDial::updateScale(), and QwtSlider::xyPosition().

### double QwtDblRange::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()**.

**See also:**

**QwtDblRange::setRange()**

Definition at line 339 of file qwt\_drange.cpp.

Referenced by QwtDial::drawContents(), QwtWheel::drawWheel(), QwtWheel::getValue(), QwtSlider::getValue(), QwtDial::getValue(), QwtDial::keyPressEvent(), QwtCounter::minVal(), QwtSlider::rangeChange(), QwtSlider::scaleChange(), QwtCounter::setMaxValue(), QwtDial::updateScale(), and QwtSlider::xyPosition().

### int QwtDblRange::pageSize () const

Returns the page size in steps.

Definition at line 354 of file qwt\_drange.cpp.

Referenced by QwtDial::keyPressEvent().

### bool QwtDblRange::periodic () const

Returns TRUE if the range is periodic.

**See also:**

**QwtDblRange::setPeriodic()**

Definition at line 348 of file qwt\_drange.cpp.

Referenced by QwtDial::wrapping().

### double QwtDblRange::prevValue () const` [protected]`

Returns the previous value.

Definition at line 386 of file qwt\_drange.cpp.

Referenced by QwtSliderBase::keyPressEvent(), QwtDial::keyPressEvent(), QwtSliderBase::mouseMoveEvent(), and QwtSliderBase::wheelEvent().

### void QwtDblRange::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 **QwtCounter**, **QwtDial**, and **QwtSlider**.

Definition at line 294 of file qwt\_drange.cpp.

Referenced by QwtSlider::rangeChange(), and setRange().

### void QwtDblRange::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 .fi
```

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.

**Parameters:**

*tf* TRUE for a periodic range

Definition at line 248 of file qwt\_drange.cpp.

Referenced by QwtDial::setWrapping().

### void QwtDblRange::setRange (double vmin, double vmax, double vstep = `0.0`, int pageSize = `1`)

Specify range and step size.

**Parameters:**

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

**Warning:**

- •

  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.

Definition at line 169 of file qwt\_drange.cpp.

References qwtLim(), rangeChange(), and setStep().

Referenced by QwtAnalogClock::QwtAnalogClock(), QwtCounter::QwtCounter(), QwtDial::QwtDial(), QwtSliderBase::QwtSliderBase(), QwtCounter::setMaxValue(), and QwtCounter::setMinValue().

### void QwtDblRange::setStep (double vstep)

Change the step raster.

**Parameters:**

*vstep* new step width

**Warning:**

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

Reimplemented in **QwtCounter**.

Definition at line 208 of file qwt\_drange.cpp.

References stepChange().

Referenced by setRange(), and QwtCounter::setStep().

### void QwtDblRange::setValid (bool)

Set the value to be valid/invalid.

Reimplemented in **QwtSliderBase**.

Definition at line 41 of file qwt\_drange.cpp.

References valueChange().

Referenced by QwtSliderBase::setValid().

### void QwtDblRange::setValue (double x)` [virtual]`

Set a new value without adjusting to the step raster.

**Parameters:**

*x* new value

**Warning:**

The value is clipped when it lies outside the range. When the range is **QwtDblRange::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.

Reimplemented in **QwtCounter**, and **QwtSliderBase**.

Definition at line 147 of file qwt\_drange.cpp.

Referenced by QwtSliderBase::setValue(), and QwtCounter::setValue().

### double QwtDblRange::step () const

**Returns:**

the step size

**See also:**

**QwtDblRange::setStep**, **QwtDblRange::setRange**

Reimplemented in **QwtCounter**.

Definition at line 313 of file qwt\_drange.cpp.

Referenced by QwtSliderBase::mouseReleaseEvent(), QwtCounter::setMaxValue(), QwtCounter::setMinValue(), QwtCounter::step(), and QwtSliderBase::timerEvent().

### void QwtDblRange::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. Definition at line 305 of file qwt\_drange.cpp.

Referenced by setStep().

### double QwtDblRange::value () const

Returns the current value.

Reimplemented in **QwtCounter**.

Definition at line 360 of file qwt\_drange.cpp.

Referenced by QwtDial::drawContents(), QwtAnalogClock::drawNeedle(), QwtCompass::drawScaleContents(), QwtSlider::drawSlider(), QwtWheel::drawWheel(), QwtSlider::getScrollMode(), QwtDial::getValue(), QwtSliderBase::keyPressEvent(), QwtDial::keyPressEvent(), QwtCompass::keyPressEvent(), QwtSliderBase::mouseMoveEvent(), QwtSliderBase::mousePressEvent(), QwtSliderBase::mouseReleaseEvent(), QwtSliderBase::timerEvent(), QwtCounter::value(), QwtSliderBase::valueChange(), and QwtSliderBase::wheelEvent().

### void QwtDblRange::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**, **QwtSliderBase**, **QwtSlider**, and **QwtWheel**.

Definition at line 283 of file qwt\_drange.cpp.

Referenced by setValid().

## Author

Generated automatically by Doxygen for Qwt User's Guide from the source code.
