Qtopia Home - Classes - Hierachy - Annotated - Functions - Licenses - Reference |
|
The QRangeControl class provides an integer value within a range. More...
#include <qrangecontrol.h>
Inherited by QSlider, QSpinBox, QDial, and QScrollBar.
It was originally designed for the QScrollBar widget, but it can also be practical for other purposes such as QSlider and QSpinBox. Here are the five main concepts in the class:
Note that 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()/pageStep().
QRangeControl provides three virtual functions that are well-suited e.g. for updating the on-screen representation of range controls and emitting signals, namely valueChange(), rangeChange() and stepChange().
Finally, QRangeControl 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, which inherit QRangeControl, provide at least a signal called valueChanged(), and many widgets will want to provide addStep(), addPage(), substractStep() and substractPage() as slots.
Note that you have to use multiple inheritance if you plan to implement a widget using QRangeControl, since QRangeControl is not derived from QWidget.
See also
value is forced to be within the legal range using the bound() method.
setValue( value()+lineStep() )plus a test for numerical overflow
If the value is changed, then valueChange() is called.
See also subtractLine(), addPage(), and setValue().
setValue( value()+pageStep() )plus a test for numerical overflow.
If the value is changed, then valueChange() is called.
See also subtractPage(), addLine(), and setValue().
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.
See also setValue(), value(), minValue(), and maxValue().
Forces the new value to be within the legal range.
You will find few cases only where you have to call this function. However, if you want to change the range controls value inside the overloaded method valueChange() then setValue() would call the function valueChange() again. To avoid this recursion you must use directSetValue() instead.
See also setValue().
Returns the current line step.
See also setSteps() and pageStep().
Returns the current maximum value of the range.
See also setRange() and minValue().
Returns the current minimum value of the range.
See also setRange() and maxValue().
Returns the current page step.
See also setSteps() and lineStep().
This function can handle the entire integer range without overflow.
Callings this method is useful when actually drawing a range control like a QScrollBar on the screen.
See also valueFromPosition().
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, since the value is forced to be inside the specified range. When the range control is initially created, this is the same as value().
Note that 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 500, setRange( 0, 400 ) makes value() return 400 and prevValue() 500)
See also value() and setRange().
Note that this method is called after the range changed.
See also setRange(), valueChange(), and stepChange().
Reimplemented in QSlider, QSpinBox, and QDial.
Calls the virtual rangeChange() function if one or both of the new min and max 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.
See also minValue() and maxValue().
Calls the virtual stepChange() function if the new line step and/or page step are different from the previous settings.
See also lineStep(), pageStep(), and setRange().
Calls the virtual valueChange() function if the new value is different from the previous value. The old value can still be retrieved using prevValue().
See also value().
Note that this method is called after the step settings changed.
See also setSteps(), rangeChange(), and valueChange().
setValue( value()-lineStep() )plus a test for numerical underflow
If the value is changed, then valueChange() is called.
See also addLine(), subtractPage(), and setValue().
setValue( value()-pageStep() )plus a test for numerical underflow
If the value is changed, then valueChange() is called.
See also addPage(), subtractLine(), and setValue().
Returns the current range control value. This is guaranteed to be within the range [ minValue() ... maxValue() ].
See also setValue() and prevValue().
Note that this method is called after the value changed. The previous value can be retrieved using prevValue().
See also setValue(), addPage(), subtractPage(), addLine(), subtractLine(), rangeChange(), and stepChange().
Reimplemented in QSlider, QSpinBox, and QDial.
This function can handle the entire integer range without overflow.
Calling this method is useful if you actually implemented a range control widget like QScrollBar and want to handle mouse press events. This function maps then screen coordinates to the logical values.
See also positionFromValue().
This file is part of the Qtopia platform, copyright © 1995-2005 Trolltech, all rights reserved.
| Copyright © 2005 Trolltech | Trademarks | Qtopia version 2.2.0
|