KDoubleSpinBox Class Reference
This class provides a spin box for fractional numbers. A spin box for fractional numbers. More...
#include <knuminput.h>
Inheritance diagram for KDoubleSpinBox:

Public Slots | |
virtual void | setValue (double value) |
Signals | |
void | valueChanged (double value) |
Public Member Functions | |
KDoubleSpinBox (QWidget *parent=0, const char *name=0) | |
KDoubleSpinBox (double lower, double upper, double step, double value, int precision=2, QWidget *parent=0, const char *name=0) | |
bool | acceptLocalizedNumbers () const |
virtual void | setAcceptLocalizedNumbers (bool accept) |
void | setRange (double lower, double upper, double step=0.01, int precision=2) |
int | precision () const |
void | setPrecision (int precision) |
virtual void | setPrecision (int precision, bool force) |
double | value () const |
double | minValue () const |
void | setMinValue (double value) |
double | maxValue () const |
void | setMaxValue (double value) |
double | lineStep () const |
void | setLineStep (double step) |
void | setValidator (const QValidator *) |
Protected Slots | |
void | slotValueChanged (int value) |
Protected Member Functions | |
virtual QString | mapValueToText (int) |
virtual int | mapTextToValue (bool *) |
virtual void | virtual_hook (int id, void *data) |
Detailed Description
This class provides a spin box for fractional numbers. A spin box for fractional numbers.
Parameters
There are a number of interdependent parameters whose relation to each other you need to understand in order to make successful use of the spin box.
- precision: The number of decimals after the decimal point.
- maxValue/minValue: upper and lower bound of the valid range
- lineStep: the size of the step that is taken when the user hits the up or down buttons
Since the value, bounds and step are rounded to the current precision, you may experience that the order of setting above parameters matters. E.g. the following are not equivalent (try it!):
// sets precision, // then min/max value (rounded to precision and clipped to obtainable range if needed) // then value and lineStep KDoubleSpinBox * spin = new KDoubleSpinBox( 0, 9.999, 0.001, 4.321, 3, this ); // sets minValue to 0; maxValue to 10.00(!); value to 4.32(!) and only then // increases the precision - too late, since e.g. value has already been rounded... KDpubleSpinBox * spin = new KDoubleSpinBox( this ); spin->setMinValue( 0 ); spin->setMaxValue( 9.999 ); spin->setValue( 4.321 ); spin->setPrecision( 3 );
- Author:
- Marc Mutz <mutz@kde.org>
- Version:
- Id
- knuminput.h,v 1.56 2003/10/07 22:53:26 mueller Exp
- Since:
- 3.1
Definition at line 823 of file knuminput.h.
Constructor & Destructor Documentation
|
Constructs a KDoubleSpinBox with parent
Definition at line 996 of file knuminput.cpp. References QSpinBox::editor(). |
|
Constructs a KDoubleSpinBox with parent
Definition at line 1004 of file knuminput.cpp. References QSpinBox::editor(), setRange(), setValue(), and valueChanged(). |
Member Function Documentation
|
Definition at line 1020 of file knuminput.cpp. |
|
Sets whether to use and accept localized numbers as returned by KLocale::formatNumber().
Definition at line 1026 of file knuminput.cpp. |
|
Sets a new range for the spin box values.
Note that Definition at line 1031 of file knuminput.cpp. References setLineStep(), setMaxValue(), setMinValue(), and setPrecision(). Referenced by KDoubleSpinBox(). |
|
Definition at line 1041 of file knuminput.cpp. |
|
Equivalent to setPrecsion(
Definition at line 1045 of file knuminput.cpp. Referenced by setRange(). |
|
Sets the number of decimal points to use. Note that there is a tradeoff between the precision used and the available range of values. See the class docs for more.
Definition at line 1049 of file knuminput.cpp. |
|
Reimplemented from QSpinBox. Definition at line 1071 of file knuminput.cpp. Referenced by KInputDialog::getDouble(), and setValue(). |
|
Reimplemented from QSpinBox. Definition at line 1088 of file knuminput.cpp. Referenced by setLineStep(), and setValue(). |
|
Sets the lower bound of the range to
Definition at line 1092 of file knuminput.cpp. Referenced by setRange(). |
|
Reimplemented from QSpinBox. Definition at line 1101 of file knuminput.cpp. Referenced by setLineStep(), and setValue(). |
|
Sets the upper bound of the range to
Definition at line 1105 of file knuminput.cpp. Referenced by setRange(). |
|
Reimplemented from QSpinBox. Definition at line 1113 of file knuminput.cpp. |
|
Sets the step size for clicking the up/down buttons to
Definition at line 1117 of file knuminput.cpp. References maxValue(), and minValue(). Referenced by setRange(). |
|
Overridden to ignore any setValidator() calls.
Reimplemented from QSpinBox. Definition at line 1147 of file knuminput.cpp. |
|
Emitted whenever QSpinBox::valueChanged( int ) is emitted.
Referenced by KDoubleSpinBox(). |
|
Sets the current value to
Definition at line 1075 of file knuminput.cpp. References maxValue(), minValue(), and value(). Referenced by KDoubleSpinBox(). |
The documentation for this class was generated from the following files: