|
|
KDoubleNumInput combines a QSpinBox and optionally a QSlider with a label to make an easy to use control for setting some float parameter. This is especially nice for configuration dialogs, which can have many such combinated controls.
The slider is created only when the user specifies a range for the control using the setRange function with the slider parameter set to "true".
A special feature of KDoubleNumInput, designed specifically for the situation when there are several instances in a column, is that you can specify what portion of the control is taken by the QSpinBox (the remaining portion is used by the slider). This makes it very simple to have all the sliders in a column be the same size.
It uses the KDoubleValidator validator class. KDoubleNumInput enforces the value to be in the given range, but see the class documentation of KDoubleSpinBox for the tricky interrelationship of precision and values. All of what is said there applies here, too.
See also: KIntNumInput, KDoubleSpinBox
KDoubleNumInput (QWidget *parent=0, const char *name=0)
| KDoubleNumInput |
Constructs an input control for double values with initial value 0.00.
KDoubleNumInput (double value, QWidget *parent=0, const char *name=0)
| KDoubleNumInput |
Constructor
Parameters:
value | initial value for the control |
parent | parent QWidget |
name | internal name for this widget |
KDoubleNumInput (double lower, double upper, double value, double step=0.01,
int precision=2, QWidget *parent=0, const char *name=0)
| KDoubleNumInput |
Constructor
Parameters:
lower | lower boundary value |
upper | upper boundary value |
value | initial value for the control |
step | step size to use for up/down arrow clicks |
precision | number of digits after the decimal point |
parent | parent QWidget |
name | internal name for this widget |
~KDoubleNumInput ()
| ~KDoubleNumInput |
[virtual]
destructor
KDoubleNumInput (KNumInput* below, double value, QWidget* parent=0, const char* name=0)
| KDoubleNumInput |
Constructor
puts it below other KNumInput
Parameters:
value | initial value for the control |
parent | parent QWidget |
name | internal name for this widget |
KDoubleNumInput (KNumInput* below,
double lower, double upper, double value, double step=0.02,
int precision=2, QWidget *parent=0, const char *name=0)
| KDoubleNumInput |
Constructor
puts it below other KNumInput
Parameters:
lower | lower boundary value |
upper | upper boundary value |
value | initial value for the control |
step | step size to use for up/down arrow clicks |
precision | number of digits after the decimal point |
parent | parent QWidget |
name | internal name for this widget |
double value ()
| value |
[const]
Returns: the current value.
QString suffix ()
| suffix |
[const]
Returns: the suffix.
See also: setSuffix()
QString prefix ()
| prefix |
[const]
Returns: the prefix.
See also: setPrefix()
int precision ()
| precision |
[const]
Returns: the precision.
See also: setPrecision()
QString specialValueText ()
| specialValueText |
[const]
Returns: the string displayed for a special value.
See also: setSpecialValueText()
void setRange (double min, double max, double step=1, bool slider=true)
| setRange |
Parameters:
min | minimum value |
max | maximum value |
step | step size for the QSlider |
void setMinValue (double min)
| setMinValue |
Sets the minimum value.
double minValue ()
| minValue |
[const]
Returns: the minimum value.
void setMaxValue (double max)
| setMaxValue |
Sets the maximum value.
double maxValue ()
| maxValue |
[const]
Returns: the maximum value.
void setPrecision (int precision)
| setPrecision |
Specifies the number of digits to use.
double referencePoint ()
| referencePoint |
[const]
Returns: the reference point for relativeValue calculation
double relativeValue ()
| relativeValue |
[const]
Returns: the current value in units of referencePoint.
void setSpecialValueText (const QString& text)
| setSpecialValueText |
Sets the special value text. If set, the spin box will display this text instead of the numeric value whenever the current value is equal to minVal(). Typically this is used for indicating that the choice has a special (default) meaning.
void setLabel (const QString & label, int a = AlignLeft | AlignTop)
| setLabel |
[virtual]
Reimplemented from KNumInput for internal purposes..
QSize minimumSizeHint ()
| minimumSizeHint |
[const virtual]
bool eventFilter (QObject*, QEvent*)
| eventFilter |
[virtual]
void setValue (double)
| setValue |
[slot]
Sets the value of the control.
void setRelativeValue (double)
| setRelativeValue |
[slot]
Sets the value in units of referencePoint.
void setReferencePoint (double ref)
| setReferencePoint |
[slot]
Sets the reference Point to ref
. It ref
== 0, emitting of
relativeValueChanged is blocked and relativeValue
just returns 0.
void setSuffix (const QString &suffix)
| setSuffix |
[slot]
Sets the suffix to be displayed to suffix
. Use QString::null to disable
this feature. Note that the suffix is attached to the value without any
spacing. So if you prefer to display a space separator, set suffix
to something like " cm".
See also: setSuffix()
void setPrefix (const QString &prefix)
| setPrefix |
[slot]
Sets the prefix to be displayed to prefix
. Use QString::null to disable
this feature. Note that the prefix is attached to the value without any
spacing.
See also: setPrefix()
void valueChanged (double)
| valueChanged |
[signal]
Emitted every time the value changes (by calling setValue() or by user interaction).
void relativeValueChanged (double)
| relativeValueChanged |
[signal]
This is an overloaded member function, provided for convenience. It essentially behaves like the above function.
Contains the value in units of referencePoint.
void doLayout ()
| doLayout |
[protected virtual]
Reimplemented from KNumInput for internal purposes..
void resizeEvent ( QResizeEvent * )
| resizeEvent |
[protected]
void resetEditBox ()
| resetEditBox |
[protected virtual]
KDoubleLine* edit | edit |
[protected]
bool m_range | m_range |
[protected]
double m_lower | m_lower |
[protected]
double m_upper | m_upper |
[protected]
double m_step | m_step |
[protected]
QSize m_sizeEdit | m_sizeEdit |
[protected]
friend class KDoubleLine | KDoubleLine |
[protected]
void virtual_hook ( int id, void* data )
| virtual_hook |
[protected virtual]
Reimplemented from KNumInput.
Generated by: caleb on tcdevel on Tue Jan 28 12:54:10 2003, using kdoc $. |