.TH "KDoubleSpinBox" 3 "28 Jan 2004" "kdeui Library" \" -*- nroff -*-
.ad l
.nh
.SH NAME
KDoubleSpinBox \- This class provides a spin box for fractional numbers. 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
.RI "\fISets the current value to \fCvalue\fP, cubject to the constraints that \fCvalue\fP is frist rounded to the current precision and then clipped to the interval [\fCminvalue()\fP,\fC\fBmaxValue()\fP\fP]. \fP"
.in -1c
.SS "Signals"

.in +1c
.ti -1c
.RI "void \fBvalueChanged\fP (double value)"
.br
.RI "\fIEmitted whenever \fBQSpinBox::valueChanged\fP( int ) is emitted. \fP"
.in -1c
.SS "Public Member Functions"

.in +1c
.ti -1c
.RI "\fBKDoubleSpinBox\fP (\fBQWidget\fP *parent=0, const  char *name=0)"
.br
.RI "\fIConstructs a \fBKDoubleSpinBox\fP with parent \fCparent\fP and default values for range and value (whatever \fBQRangeControl\fP uses) and precision (2). \fP"
.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
.RI "\fIConstructs a \fBKDoubleSpinBox\fP with parent \fCparent\fP, range [\fClower\fP,\fCupper\fP], \fBlineStep\fP \fCstep\fP, \fBprecision\fP \fCprecision\fP and initial value \fCvalue\fP. \fP"
.ti -1c
.RI "bool \fBacceptLocalizedNumbers\fP () const "
.br
.ti -1c
.RI "virtual void \fBsetAcceptLocalizedNumbers\fP (bool accept)"
.br
.RI "\fISets whether to use and accept localized numbers as returned by \fBKLocale::formatNumber\fP(). \fP"
.ti -1c
.RI "void \fBsetRange\fP (double lower, double upper, double step=0.01, int precision=2)"
.br
.RI "\fISets a new range for the spin box values. \fP"
.ti -1c
.RI "int \fBprecision\fP () const "
.br
.ti -1c
.RI "void \fBsetPrecision\fP (int precision)"
.br
.RI "\fIEquivalent to \fBsetPrecsion\fP( \fCprecison\fP, \fCfalse\fP ); Needed since Qt's moc doesn't ignore trailing parameters with default args when searching for a property setter method. \fP"
.ti -1c
.RI "virtual void \fBsetPrecision\fP (int precision, bool force)"
.br
.RI "\fISets the number of decimal points to use. \fP"
.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
.RI "\fISets 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 representable interval. \fP"
.ti -1c
.RI "double \fBmaxValue\fP () const "
.br
.ti -1c
.RI "void \fBsetMaxValue\fP (double value)"
.br
.RI "\fISets 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 representable interval. \fP"
.ti -1c
.RI "double \fBlineStep\fP () const "
.br
.ti -1c
.RI "void \fBsetLineStep\fP (double step)"
.br
.RI "\fISets 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, \fCmaxValue\fP - \fCminValue\fP]. \fP"
.ti -1c
.RI "void \fBsetValidator\fP (const  \fBQValidator\fP *)"
.br
.RI "\fIOverridden to ignore any \fBsetValidator()\fP calls. \fP"
.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
.SH "Detailed Description"
.PP 
This class provides a spin box for fractional numbers. A spin box for fractional numbers. 

\fB Parameters\fP
.PP
\fB 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.\fP
.PP
\fB 
.IP "\(bu" 2
precision: The number of decimals after the decimal point. 
.IP "\(bu" 2
maxValue/minValue: upper and lower bound of the valid range 
.IP "\(bu" 2
lineStep: the size of the step that is taken 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 relations hold: 
.PP
.nf

   max( abs(\fBminValue()\fP), abs(\fBmaxValue()\fP ) <= INT_MAX/10^precision
   maxPrecision = floor( log10( INT_MAX/max(abs(\fBminValue()\fP),abs(\fBmaxValue()\fP)) ) )
   
.PP
\fP
.PP
\fB 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 \fInot\fP equivalent (try it!):\fP
.PP
\fB 
.PP
.nf

   // sets precision,
   // then min/max value (rounded to precison and clipped to obtainable range if needed)
   // then value and lineStep
   KDoubleSpinBox * spin = new KDoubleSpinBox( 0, 9.999, 0.001, 4.321, 3, this );
.PP
\fP
.PP
\fB
.PP
.nf
   // 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 );
   
.PP
\fP
.PP
\fB\fP
.PP
\fB
.PP
\fBAuthor:\fP
.RS 4
Marc Mutz <mutz@kde.org> 
.RE
.PP
\fBVersion:\fP
.RS 4
\fBId\fP.RS 4
\fBknuminput.h\fP,v 1.44 2002/09/28 15:16:22 tjansen Exp 
.RE
.PP
.RE
.PP
\fBSince:\fP
.RS 4
3.1 
.RE
.PP
\fP
.PP
Definition at line 834 of file knuminput.h.
.SH "Constructor & Destructor Documentation"
.PP 
.SS "KDoubleSpinBox::KDoubleSpinBox (\fBQWidget\fP * parent = 0, const char * name = 0)"
.PP
Constructs a \fBKDoubleSpinBox\fP with parent \fCparent\fP and default values for range and value (whatever \fBQRangeControl\fP uses) and precision (2). Definition at line 912 of file knuminput.cpp.
.PP
References QSpinBox::editor(), and KStdAccel::name().
.SS "KDoubleSpinBox::KDoubleSpinBox (double lower, double upper, double step, double value, int precision = 2, \fBQWidget\fP * parent = 0, const char * name = 0)"
.PP
Constructs a \fBKDoubleSpinBox\fP with parent \fCparent\fP, range [\fClower\fP,\fCupper\fP], \fBlineStep\fP \fCstep\fP, \fBprecision\fP \fCprecision\fP and initial value \fCvalue\fP. Definition at line 920 of file knuminput.cpp.
.PP
References QSpinBox::editor(), KStdAccel::name(), 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
Definition at line 936 of file knuminput.cpp.
.SS "void KDoubleSpinBox::setAcceptLocalizedNumbers (bool accept)\fC [virtual]\fP"
.PP
Sets whether to use and accept localized numbers as returned by \fBKLocale::formatNumber\fP(). Definition at line 942 of file knuminput.cpp.
.SS "void KDoubleSpinBox::setRange (double lower, double upper, double step = 0.01, int precision = 2)"
.PP
Sets a new range for the spin box values. Note that \fClower\fP, \fCupper\fP and \fCstep\fP are rounded to \fCprecision\fP decimal points first. Definition at line 947 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 decimal points displayed. 
.RE
.PP
Definition at line 957 of file knuminput.cpp.
.SS "void KDoubleSpinBox::setPrecision (int precision)"
.PP
Equivalent to \fBsetPrecsion\fP( \fCprecison\fP, \fCfalse\fP ); Needed since Qt's moc doesn't ignore trailing parameters with default args when searching for a property setter method. Definition at line 961 of file knuminput.cpp.
.PP
Referenced by setRange().
.SS "void KDoubleSpinBox::setPrecision (int precision, bool force)\fC [virtual]\fP"
.PP
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. 
.PP
\fBParameters:\fP
.RS 4
\fIprecision\fP the new number of decimal points to use
.br
\fIforce\fP disables checking of bound 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 don't want to keep the current min and max values anyway. This is what e.g. \fBsetRange\fP() does. 
.RE
.PP
Definition at line 965 of file knuminput.cpp.
.SS "double KDoubleSpinBox::value () const"
.PP
\fBReturns:\fP
.RS 4
the current value 
.RE
.PP
Reimplemented from \fBQSpinBox\fP.
.PP
Definition at line 987 of file knuminput.cpp.
.PP
Referenced by setValue().
.SS "double KDoubleSpinBox::minValue () const"
.PP
\fBReturns:\fP
.RS 4
the current lower bound 
.RE
.PP
Reimplemented from \fBQSpinBox\fP.
.PP
Definition at line 1004 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 representable interval. \fBSee also:\fP
.RS 4
\fBmaxValue\fP, \fBminValue\fP, \fBsetMaxValue\fP, \fBsetRange\fP 
.RE
.PP
Definition at line 1008 of file knuminput.cpp.
.PP
Referenced by setRange().
.SS "double KDoubleSpinBox::maxValue () const"
.PP
\fBReturns:\fP
.RS 4
the current upper bound 
.RE
.PP
Reimplemented from \fBQSpinBox\fP.
.PP
Definition at line 1017 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 representable interval. \fBSee also:\fP
.RS 4
\fBminValue\fP, \fBmaxValue\fP, \fBsetMinValue\fP, \fBsetRange\fP 
.RE
.PP
Definition at line 1021 of file knuminput.cpp.
.PP
Referenced by setRange().
.SS "double KDoubleSpinBox::lineStep () const"
.PP
\fBReturns:\fP
.RS 4
the current step size 
.RE
.PP
Reimplemented from \fBQSpinBox\fP.
.PP
Definition at line 1029 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, \fCmaxValue\fP - \fCminValue\fP]. Definition at line 1033 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. Reimplemented from \fBQSpinBox\fP.
.PP
Definition at line 1063 of file knuminput.cpp.
.SS "void KDoubleSpinBox::valueChanged (double value)\fC [signal]\fP"
.PP
Emitted whenever \fBQSpinBox::valueChanged\fP( int ) is emitted. Referenced by KDoubleSpinBox().
.SS "void KDoubleSpinBox::setValue (double value)\fC [virtual, slot]\fP"
.PP
Sets the current value to \fCvalue\fP, cubject to the constraints that \fCvalue\fP is frist rounded to the current precision and then clipped to the interval [\fCminvalue()\fP,\fC\fBmaxValue()\fP\fP]. Definition at line 991 of file knuminput.cpp.
.PP
References maxValue(), minValue(), and value().
.PP
Referenced by KDoubleSpinBox().

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