Eneboo - Documentación para desarrolladores
Métodos públicos | Métodos protegidos
Referencia de la Clase QRangeControl

The QRangeControl class provides an integer value within a range. Más...

#include <qrangecontrol.h>

Diagrama de herencias de QRangeControl
QDial QDial QScrollBar QScrollBar QSlider QSlider QSpinBox QSpinBox

Lista de todos los miembros.

Métodos públicos

 QRangeControl ()
 QRangeControl (int minValue, int maxValue, int lineStep, int pageStep, int value)
virtual ~QRangeControl ()
int value () const
void setValue (int)
void addPage ()
void subtractPage ()
void addLine ()
void subtractLine ()
int minValue () const
int maxValue () const
void setRange (int minValue, int maxValue)
void setMinValue (int minVal)
void setMaxValue (int minVal)
int lineStep () const
int pageStep () const
void setSteps (int line, int page)
int bound (int) const
 QRangeControl ()
 QRangeControl (int minValue, int maxValue, int lineStep, int pageStep, int value)
virtual ~QRangeControl ()
int value () const
void setValue (int)
void addPage ()
void subtractPage ()
void addLine ()
void subtractLine ()
int minValue () const
int maxValue () const
void setRange (int minValue, int maxValue)
void setMinValue (int minVal)
void setMaxValue (int minVal)
int lineStep () const
int pageStep () const
void setSteps (int line, int page)
int bound (int) const

Métodos protegidos

int positionFromValue (int val, int space) const
int valueFromPosition (int pos, int space) const
void directSetValue (int val)
int prevValue () const
virtual void valueChange ()
virtual void rangeChange ()
virtual void stepChange ()
int positionFromValue (int val, int space) const
int valueFromPosition (int pos, int space) const
void directSetValue (int val)
int prevValue () const
virtual void valueChange ()
virtual void rangeChange ()
virtual void stepChange ()

Descripción detallada

The QRangeControl class provides an integer value within a range.

Although originally designed for the QScrollBar widget, the QRangeControl can also be used in conjunction with other widgets such as QSlider and QSpinBox. Here are the five main concepts in the class:

1

{Current value} The bounded integer that QRangeControl maintains. value() returns it, and several functions, including setValue(), set it.

{Minimum} The lowest value that value() can ever return. Returned by minValue() and set by setRange() or one of the constructors.

{Maximum} The highest value that value() can ever return. Returned by maxValue() and set by setRange() or one of the constructors.

{Line step} The smaller of two natural steps that QRangeControl provides and typically corresponds to the user pressing an arrow key. The line step is returned by lineStep() and set using setSteps(). The functions addLine() and subtractLine() respectively increment and decrement the current value by lineStep().

{Page step} The larger of two natural steps that QRangeControl provides and typically corresponds to the user pressing PageUp or PageDown. The page step is returned by pageStep() and set using setSteps(). The functions addPage() and substractPage() respectively increment and decrement the current value by pageStep().

Unity (1) may be viewed as a third step size. setValue() lets you set the current value to any integer in the allowed range, not just minValue() + n * lineStep() for integer values of n. Some widgets may allow the user to set any value at all; others may just provide multiples of lineStep() or pageStep().

QRangeControl provides three virtual functions that are well suited for updating the on-screen representation of range controls and emitting signals: valueChange(), rangeChange() and stepChange().

QRangeControl also provides a function called bound() which lets you force arbitrary integers to be within the allowed range of the range control.

We recommend that all widgets that inherit QRangeControl provide at least a signal called valueChanged(); many widgets will want to provide addStep(), addPage(), substractStep() and substractPage() as slots.

Note that you must use multiple inheritance if you plan to implement a widget using QRangeControl because QRangeControl is not derived from QWidget.


Documentación del constructor y destructor

QRangeControl::QRangeControl ( )

Constructs a range control with a minimum value of 0, maximum value of 99, line step of 1, page step of 10 and initial value 0.

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

Constructs a range control whose value can never be smaller than minValue or greater than maxValue, whose line step size is lineStep and page step size is pageStep and whose value is initially value (which is guaranteed to be in range using bound()).

QRangeControl::~QRangeControl ( ) [virtual]

Destroys the range control

QRangeControl::QRangeControl ( )
QRangeControl::QRangeControl ( int  minValue,
int  maxValue,
int  lineStep,
int  pageStep,
int  value 
)
virtual QRangeControl::~QRangeControl ( ) [virtual]

Documentación de las funciones miembro

void QRangeControl::addLine ( )

Equivalent to {setValue( value() + lineStep() )}.

If the value is changed, then valueChange() is called.

Ver también:
subtractLine() addPage() setValue()

Reimplementado en QDial, QSlider, QDial y QSlider.

void QRangeControl::addLine ( )

Reimplementado en QDial, QSlider, QDial y QSlider.

void QRangeControl::addPage ( )

Equivalent to {setValue( value() + pageStep() )}.

If the value is changed, then valueChange() is called.

Ver también:
subtractPage() addLine() setValue()

Reimplementado en QDial y QDial.

void QRangeControl::addPage ( )

Reimplementado en QDial y QDial.

int QRangeControl::bound ( int  ) const
int QRangeControl::bound ( int  v) const

Forces the value v to be within the range from minValue() to maxValue() inclusive, and returns the result.

This function is provided so that you can easily force other numbers than value() into the allowed range. You do not need to call it in order to use QRangeControl itself.

Ver también:
setValue() value() minValue() maxValue()
void QRangeControl::directSetValue ( int  value) [protected]

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

Forces the new value to be within the legal range.

You will rarely have to call this function. However, if you want to change the range control's value inside the overloaded method valueChange(), setValue() would call the function valueChange() again. To avoid this recursion you must use directSetValue() instead.

Ver también:
setValue()
void QRangeControl::directSetValue ( int  val) [protected]
int QRangeControl::lineStep ( ) const
int QRangeControl::lineStep ( ) const [inline]

Returns the line step.

Ver también:
setSteps() pageStep()

Reimplementado en QDial, QScrollBar, QSlider, QSpinBox, QDial, QScrollBar, QSlider y QSpinBox.

int QRangeControl::maxValue ( ) const [inline]

Returns the maximum value of the range.

Ver también:
setMaxValue() setRange() minValue()

Reimplementado en QDial, QScrollBar, QSlider, QSpinBox, QDial, QScrollBar, QSlider y QSpinBox.

int QRangeControl::maxValue ( ) const
int QRangeControl::minValue ( ) const [inline]

Returns the minimum value of the range.

Ver también:
setMinValue() setRange() maxValue()

Reimplementado en QDial, QScrollBar, QSlider, QSpinBox, QDial, QScrollBar, QSlider y QSpinBox.

int QRangeControl::minValue ( ) const
int QRangeControl::pageStep ( ) const

Reimplementado en QDial, QScrollBar, QSlider, QDial, QScrollBar y QSlider.

int QRangeControl::pageStep ( ) const [inline]

Returns the page step.

Ver también:
setSteps() lineStep()

Reimplementado en QDial, QScrollBar, QSlider, QDial, QScrollBar y QSlider.

int QRangeControl::positionFromValue ( int  logical_val,
int  span 
) const [protected]

Converts logical_val to a pixel position. minValue() maps to 0, maxValue() maps to span and other values are distributed evenly in-between.

This function can handle the entire integer range without overflow, providing span is <= 4096.

Calling this method is useful when actually drawing a range control such as a QScrollBar on-screen.

Ver también:
valueFromPosition()
int QRangeControl::positionFromValue ( int  val,
int  space 
) const [protected]
int QRangeControl::prevValue ( ) const [inline, protected]

Returns the previous value of the range control. "Previous value" means the value before the last change occurred. Setting a new range may affect the value, too, because the value is forced to be inside the specified range. When the range control is initially created, this is the same as value().

prevValue() can be outside the current legal range if a call to setRange() causes the current value to change. For example, if the range was [0, 1000] and the current value is 500, setRange(0, 400) makes value() return 400 and prevValue() return 500.

Ver también:
value() setRange()
int QRangeControl::prevValue ( ) const [protected]
void QRangeControl::rangeChange ( ) [protected, virtual]

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

Note that this method is called after the range has changed.

Ver también:
setRange(), valueChange(), stepChange()

Reimplementado en QDial, QScrollBar, QSlider, QSpinBox, QDial, QScrollBar, QSlider y QSpinBox.

virtual void QRangeControl::rangeChange ( ) [protected, virtual]
void QRangeControl::setMaxValue ( int  minVal)
void QRangeControl::setMaxValue ( int  maxVal)

Sets the minimum value of the range to maxVal.

If necessary, the minValue() is adjusted so that the range remains valid.

Ver también:
maxValue() setMinValue()

Reimplementado en QDial, QScrollBar, QSlider, QSpinBox, QDial, QScrollBar, QSlider y QSpinBox.

void QRangeControl::setMinValue ( int  minVal)
void QRangeControl::setMinValue ( int  minVal)

Sets the minimum value of the range to minVal.

If necessary, the maxValue() is adjusted so that the range remains valid.

Ver también:
minValue() setMaxValue()

Reimplementado en QDial, QScrollBar, QSlider, QSpinBox, QDial, QScrollBar, QSlider y QSpinBox.

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

Sets the range control's minimum value to minValue and its maximum value to maxValue.

Calls the virtual rangeChange() function if one or both of the new minimum and maximum values are different from the previous setting. Calls the virtual valueChange() function if the current value is adjusted because it was outside the new range.

If maxValue is smaller than minValue, minValue becomes the only legal value.

Ver también:
minValue() maxValue()
void QRangeControl::setRange ( int  minValue,
int  maxValue 
)
void QRangeControl::setSteps ( int  line,
int  page 
)
void QRangeControl::setSteps ( int  lineStep,
int  pageStep 
)

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

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

Ver también:
lineStep() pageStep() setRange()
void QRangeControl::setValue ( int  )
void QRangeControl::setValue ( int  value)

Sets the range control's value to value and forces it to be within the legal range.

Calls the virtual valueChange() function if the new value is different from the previous value. The old value can still be retrieved using prevValue().

Ver también:
value()

Reimplementado en QDial, QScrollBar, QSlider, QSpinBox, QDial, QScrollBar, QSlider y QSpinBox.

void QRangeControl::stepChange ( ) [protected, virtual]

This virtual function is called whenever the range control's line or page step settings change. You can reimplement it if you want to be notified when the step changes. The default implementation does nothing.

Note that this method is called after a step setting has changed.

Ver también:
setSteps(), rangeChange(), valueChange()

Reimplementado en QScrollBar y QScrollBar.

virtual void QRangeControl::stepChange ( ) [protected, virtual]

Reimplementado en QScrollBar y QScrollBar.

void QRangeControl::subtractLine ( )

Reimplementado en QDial, QSlider, QDial y QSlider.

void QRangeControl::subtractLine ( )

Equivalent to {setValue( value() - lineStep() )}.

If the value is changed, then valueChange() is called.

Ver también:
addLine() subtractPage() setValue()

Reimplementado en QDial, QSlider, QDial y QSlider.

void QRangeControl::subtractPage ( )

Equivalent to {setValue( value() - pageStep() )}.

If the value is changed, then valueChange() is called.

Ver también:
addPage() subtractLine() setValue()

Reimplementado en QDial y QDial.

void QRangeControl::subtractPage ( )

Reimplementado en QDial y QDial.

int QRangeControl::value ( ) const [inline]

Returns the current range control value. This is guaranteed to be within the range [minValue(), maxValue()].

Ver también:
setValue() prevValue()

Reimplementado en QDial, QScrollBar, QSlider, QSpinBox, QDial, QScrollBar, QSlider y QSpinBox.

int QRangeControl::value ( ) const
void QRangeControl::valueChange ( ) [protected, virtual]

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

Note that this method is called after the value has changed. The previous value can be retrieved using prevValue().

Ver también:
setValue(), addPage(), subtractPage(), addLine(), subtractLine() rangeChange(), stepChange()

Reimplementado en QDial, QScrollBar, QSlider, QSpinBox, QDial, QScrollBar, QSlider y QSpinBox.

virtual void QRangeControl::valueChange ( ) [protected, virtual]
int QRangeControl::valueFromPosition ( int  pos,
int  span 
) const [protected]

Converts the pixel position pos to a value. 0 maps to minValue(), span maps to maxValue() and other values are distributed evenly in-between.

This function can handle the entire integer range without overflow.

Calling this method is useful if you actually implemented a range control widget such as QScrollBar and want to handle mouse press events. This function then maps screen coordinates to the logical values.

Ver también:
positionFromValue()
int QRangeControl::valueFromPosition ( int  pos,
int  space 
) const [protected]

La documentación para esta clase fue generada a partir de los siguientes ficheros:
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'