.TH "KDoubleSpinBox" kde3 "11 Jun 2005" "Version Version 3.4.1" "kdeui Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KDoubleSpinBox \- A spin box for fractional numbers.  

.PP
.SH SYNOPSIS
.br
.PP
\fC#include <knuminput.h>\fP
.PP
Inherits \fBQSpinBox\fP.
.PP
.SS "Public Slots"

.in +1c
.ti -1c
.RI "virtual void \fBsetValue\fP (double value)"
.br
.in -1c
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBvalueChanged\fP (double value)"
.br
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKDoubleSpinBox\fP (\fBQWidget\fP *parent=0, const char *name=0)"
.br
.ti -1c
.RI "\fBKDoubleSpinBox\fP (double lower, double upper, double step, double value, int precision=2, \fBQWidget\fP *parent=0, const char *name=0)"
.br
.ti -1c
.RI "bool \fBacceptLocalizedNumbers\fP () const "
.br
.ti -1c
.RI "virtual void \fBsetAcceptLocalizedNumbers\fP (bool accept)"
.br
.ti -1c
.RI "void \fBsetRange\fP (double lower, double upper, double step=0.01, int precision=2)"
.br
.ti -1c
.RI "int \fBprecision\fP () const "
.br
.ti -1c
.RI "void \fBsetPrecision\fP (int precision)"
.br
.ti -1c
.RI "virtual void \fBsetPrecision\fP (int precision, bool force)"
.br
.ti -1c
.RI "double \fBvalue\fP () const "
.br
.ti -1c
.RI "double \fBminValue\fP () const "
.br
.ti -1c
.RI "void \fBsetMinValue\fP (double value)"
.br
.ti -1c
.RI "double \fBmaxValue\fP () const "
.br
.ti -1c
.RI "void \fBsetMaxValue\fP (double value)"
.br
.ti -1c
.RI "double \fBlineStep\fP () const "
.br
.ti -1c
.RI "void \fBsetLineStep\fP (double step)"
.br
.ti -1c
.RI "void \fBsetValidator\fP (const \fBQValidator\fP *)"
.br
.in -1c
.SS "Protected Slots"

.in +1c
.ti -1c
.RI "void \fBslotValueChanged\fP (int value)"
.br
.in -1c
.SS "Protected Member Functions"

.in +1c
.ti -1c
.RI "virtual \fBQString\fP \fBmapValueToText\fP (int)"
.br
.ti -1c
.RI "virtual int \fBmapTextToValue\fP (bool *)"
.br
.ti -1c
.RI "virtual void \fBvirtual_hook\fP (int id, void *data)"
.br
.in -1c
.SS "Properties"

.in +1c
.ti -1c
.RI "bool \fBacceptLocalizedNumbers\fP"
.br
.ti -1c
.RI "int \fBprecision\fP"
.br
.in -1c
.SH "Detailed Description"
.PP 
A spin box for fractional numbers. 

This class provides a spin box for fractional numbers.
.PP
KDE Fractional Number Spinbox See below for code examples on how to use this class.
.PP
\fBParameters\fP 
.br
.PP
To make successful use of KDoubleSpinBox, you need to understand the relationship between precision and available range.
.PP
.PD 0
.IP "\(bu" 2
precision: The number of digits after the decimal point. 
.IP "\(bu" 2
maxValue/minValue: upper and lower bounds of the valid range 
.IP "\(bu" 2
lineStep: the size of the step that is made when the user hits the up or down buttons
.PP
Since we work with fixed-point numbers internally, the maximum precision is a function of the valid range and vice versa. More precisely, the following relationships hold: 
.PP
.nf
   max( abs(minValue()), abs(maxValue() ) <= INT_MAX/10^precision
   maxPrecision = floor( log10( INT_MAX/max(abs(minValue()),abs(maxValue())) ) )

.fi
.PP
.PP
Since the value, bounds and lineStep are rounded to the current precision, you may find that the order of setting these parameters matters. As an example, the following are \fInot\fP equivalent (try it!):
.PP
.PP
.nf
   // 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...
   KDoubleSpinBox * spin = new KDoubleSpinBox( this );
   spin->setMinValue( 0 );
   spin->setMaxValue( 9.999 );
   spin->setValue( 4.321 );
   spin->setPrecision( 3 );
.fi
.PP
.PP
\fBAuthor:\fP
.RS 4
Marc Mutz <mutz@kde.org> 
.RE
.PP
\fBVersion:\fP
.RS 4
$Id$ 
.RE
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP

.PP
Definition at line 834 of file knuminput.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KDoubleSpinBox::KDoubleSpinBox (\fBQWidget\fP * parent = \fC0\fP, const char * name = \fC0\fP)"
.PP
Constructs a KDoubleSpinBox with parent \fCparent\fP and default values for range and value (whatever \fBQRangeControl\fP uses) and precision (2). 
.PP
Definition at line 996 of file knuminput.cpp.
.PP
References QSpinBox::editor(), and valueChanged().
.SS "KDoubleSpinBox::KDoubleSpinBox (double lower, double upper, double step, double value, int precision = \fC2\fP, \fBQWidget\fP * parent = \fC0\fP, const char * name = \fC0\fP)"
.PP
Constructs a KDoubleSpinBox with parent \fCparent\fP, range [ \fClower\fP, \fCupper\fP ], lineStep \fCstep\fP, precision \fCprecision\fP and initial value \fCvalue\fP. 
.PP
Definition at line 1005 of file knuminput.cpp.
.PP
References QSpinBox::editor(), setRange(), setValue(), and valueChanged().
.SH "Member Function Documentation"
.PP 
.SS "bool KDoubleSpinBox::acceptLocalizedNumbers () const"
.PP
\fBReturns:\fP
.RS 4
whether the spinbox uses localized numbers 
.RE
.PP

.SS "void KDoubleSpinBox::setAcceptLocalizedNumbers (bool accept)\fC [virtual]\fP"
.PP
Sets whether to use and accept localized numbers as returned by \fBKLocale::formatNumber()\fP. 
.PP
Definition at line 1027 of file knuminput.cpp.
.SS "void KDoubleSpinBox::setRange (double lower, double upper, double step = \fC0.01\fP, int precision = \fC2\fP)"
.PP
Sets a new range for the spin box values. 
.PP
Note that \fClower\fP, \fCupper\fP and \fCstep\fP are rounded to \fCprecision\fP decimal points first. 
.PP
Definition at line 1032 of file knuminput.cpp.
.PP
References setLineStep(), setMaxValue(), setMinValue(), and setPrecision().
.PP
Referenced by KDoubleSpinBox().
.SS "int KDoubleSpinBox::precision () const"
.PP
\fBReturns:\fP
.RS 4
the current number of digits displayed to the right of the decimal point. 
.RE
.PP

.SS "void KDoubleSpinBox::setPrecision (int precision)"
.PP
Equivalent to setPrecision( \fCprecision\fP, \fCfalse\fP ); Needed since Qt's moc doesn't ignore trailing parameters with default args when searching for a property setter method. 
.PP
Definition at line 1046 of file knuminput.cpp.
.PP
Referenced by setRange().
.SS "void KDoubleSpinBox::setPrecision (int precision, bool force)\fC [virtual]\fP"
.PP
Sets the precision (number of digits to the right of the decimal point). 
.PP
Note that there is a tradeoff between the precision used and the available range of values. See the class documentation above for more information on this.
.PP
\fBParameters:\fP
.RS 4
\fIprecision\fP the new precision to use
.br
\fIforce\fP if true, disables checking of bounds violations that can arise if you increase the precision so much that the minimum and maximum values can't be represented anymore. Disabling is useful if you were going to disable range control in any case. 
.RE
.PP

.PP
Definition at line 1050 of file knuminput.cpp.
.SS "double KDoubleSpinBox::value () const"
.PP
\fBReturns:\fP
.RS 4
the current value 
.RE
.PP

.PP
Reimplemented from \fBQSpinBox\fP.
.PP
Definition at line 1072 of file knuminput.cpp.
.PP
Referenced by KInputDialog::getDouble().
.SS "double KDoubleSpinBox::minValue () const"
.PP
\fBReturns:\fP
.RS 4
the current lower bound 
.RE
.PP

.PP
Reimplemented from \fBQSpinBox\fP.
.PP
Definition at line 1089 of file knuminput.cpp.
.PP
Referenced by setLineStep(), and setValue().
.SS "void KDoubleSpinBox::setMinValue (double value)"
.PP
Sets the lower bound of the range to \fCvalue\fP, subject to the contraints that \fCvalue\fP is first rounded to the current precision and then clipped to the maximum range interval that can be handled at that precision. 
.PP
\fBSee also:\fP
.RS 4
\fBmaxValue\fP, \fBminValue\fP, \fBsetMaxValue\fP, \fBsetRange\fP 
.RE
.PP

.PP
Definition at line 1093 of file knuminput.cpp.
.PP
Referenced by setRange().
.SS "double KDoubleSpinBox::maxValue () const"
.PP
\fBReturns:\fP
.RS 4
the current upper bound 
.RE
.PP

.PP
Reimplemented from \fBQSpinBox\fP.
.PP
Definition at line 1102 of file knuminput.cpp.
.PP
Referenced by setLineStep(), and setValue().
.SS "void KDoubleSpinBox::setMaxValue (double value)"
.PP
Sets the upper bound of the range to \fCvalue\fP, subject to the contraints that \fCvalue\fP is first rounded to the current precision and then clipped to the maximum range interval that can be handled at that precision. 
.PP
\fBSee also:\fP
.RS 4
\fBminValue\fP, \fBmaxValue\fP, \fBsetMinValue\fP, \fBsetRange\fP 
.RE
.PP

.PP
Definition at line 1106 of file knuminput.cpp.
.PP
Referenced by setRange().
.SS "double KDoubleSpinBox::lineStep () const"
.PP
\fBReturns:\fP
.RS 4
the current step size 
.RE
.PP

.PP
Reimplemented from \fBQSpinBox\fP.
.PP
Definition at line 1114 of file knuminput.cpp.
.SS "void KDoubleSpinBox::setLineStep (double step)"
.PP
Sets the step size for clicking the up/down buttons to \fCstep\fP, subject to the constraints that \fCstep\fP is first rounded to the current precision and then clipped to the meaningful interval [ 1, \fC\fBmaxValue()\fP\fP - \fC\fBminValue()\fP\fP ]. 
.PP
Definition at line 1118 of file knuminput.cpp.
.PP
References maxValue(), and minValue().
.PP
Referenced by setRange().
.SS "void KDoubleSpinBox::setValidator (const \fBQValidator\fP *)"
.PP
Overridden to ignore any \fBsetValidator()\fP calls. 
.PP
Reimplemented from \fBQSpinBox\fP.
.PP
Definition at line 1148 of file knuminput.cpp.
.SS "void KDoubleSpinBox::valueChanged (double value)\fC [signal]\fP"
.PP
Emitted whenever \fBQSpinBox::valueChanged( int )\fP is emitted. 
.PP
Referenced by KDoubleSpinBox().
.SS "void KDoubleSpinBox::setValue (double value)\fC [virtual, slot]\fP"
.PP
Sets the current value to \fCvalue\fP, subject to the constraints that \fCvalue\fP is first rounded to the current precision and then clipped to the interval [ \fC\fBminValue()\fP\fP , \fC\fBmaxValue()\fP\fP ]. 
.PP
Definition at line 1076 of file knuminput.cpp.
.PP
References maxValue(), and minValue().
.PP
Referenced by KDoubleSpinBox().

.SH "Author"
.PP 
Generated automatically by Doxygen for kdeui Library from the source code.
