Qt logo

QRangeControl Class Reference


The QRangeControl class provides an integer value within a range. More...

#include <qrangecontrol.h>

Inherited by QScrollBar, QSlider and QSpinBox.

List of all member functions.

Public Members

Protected Members


Detailed Description

The QRangeControl class provides an integer value within a range.

This class has many functions to manipulate a value inside a range. It was specifically designed for the QScrollBar widget, but it can also be practical for other purposes.

The three virtual functions valueChange(), rangeChange() and stepChange() can be reimplemented in a subclass to detect range control changes.


Member Function Documentation

QRangeControl::QRangeControl ()

Constructs a range control with min value 0, max value 99, line step 1, page step 10 and initial value 0.

QRangeControl::QRangeControl ( int minValue, int maxValue, int lineStep, int pageStep, int value )

Constructs a range control with the specified parameters.

void QRangeControl::addLine ()

Equivalent to

 setValue( value()+lineStep() )
.

See also: subtractLine().

void QRangeControl::addPage ()

Equivalent to

 setValue( value()+pageStep() )

See also: subtractPage().

void QRangeControl::directSetValue ( int value ) [protected]

Sets the range control value directly without calling valueChange().

Adjusts the value if it is less than the min value or greater than the max value.

See also: setValue().

int QRangeControl::lineStep () const

Returns the current line step.

See also: setSteps() and pageStep().

int QRangeControl::maxValue () const

Returns the current maximum value in the range.

See also: setRange() and minValue().

int QRangeControl::minValue () const

Returns the current minimum value in the range.

See also: setRange() and maxValue().

int QRangeControl::pageStep () const

Returns the current page step.

See also: setSteps() and lineStep().

int QRangeControl::prevValue () const [protected]

Returns the previous range control value.

See also: value().

void QRangeControl::rangeChange () [virtual protected]

This virtual function is called whenever the range control range changes. You can reimplment it if you want to be notified when the range changes. The default implementation does nothing.

See also: setRange(), valueChange() and stepChange().

Reimplemented in QSlider and QScrollBar.

void QRangeControl::setRange ( int minValue, int maxValue )

Sets the range min value to minValue and the max value to maxValue.

Calls the virtual rangeChange() function if the new min and max values are different from the previous setting. Calls the virtual valueChange() function if the current value is outside the new range and has to be adjusted.

See also: minValue() and maxValue().

Examples: xform/xform.cpp

void QRangeControl::setSteps ( int lineStep,int pageStep )

Sets the range line step to lineStep and page step to pageStep.

Calls the virtual stepChange() function if the new line step and/or page step are different from the previous setting.

See also: setRange().

void QRangeControl::setValue ( int value )

Sets the range control value to value.

Adjusts the value if it is less than the min value or greater than the max value.

Calls the virtual valueChange() function if the value is different from the previous value.

void QRangeControl::stepChange () [virtual protected]

This virtual function is called whenever the range control step value changes. You can reimplment it if you want to be notified when the step changes. The default implementation does nothing.

See also: setSteps(), rangeChange() and valueChange().

Reimplemented in QScrollBar.

void QRangeControl::subtractLine ()

Equivalent to

 setValue( value()-lineStep() )
.

See also: addLine().

void QRangeControl::subtractPage ()

Equivalent to

 setValue( value()-pageStep() )

See also: addPage().

int QRangeControl::value () const

Returns the current range control value.

See also: setValue() and prevValue().

Examples: xform/xform.cpp

void QRangeControl::valueChange () [virtual protected]

This virtual function is called whenever the range control value changes. You can reimplment it if you want to be notified when the value changes. The default implementation does nothing.

See also: setValue(), addPage(), subtractPage(), addLine(), subtractLine(), rangeChange() and stepChange().

Reimplemented in QSlider and QScrollBar.


Search the documentation, FAQ, qt-interest archive and more (uses www.troll.no):


This file is part of the Qt toolkit, copyright © 1995-98 Troll Tech, all rights reserved.

It was generated from the following files:


Copyright © 1998 Troll TechTrademarks
Qt version 1.42