\section{KDouble\-Spin\-Box Class Reference}
\label{classKDoubleSpinBox}\index{KDoubleSpinBox@{KDoubleSpinBox}}
This class provides a spin box for fractional numbers. A spin box for fractional numbers.  


{\tt \#include $<$knuminput.h$>$}

Inheritance diagram for KDouble\-Spin\-Box:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=66pt]{classKDoubleSpinBox__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KDouble\-Spin\-Box:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=66pt]{classKDoubleSpinBox__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
virtual void {\bf set\-Value} (double value)
\begin{CompactList}\small\item\em Sets the current value to {\tt value}, cubject to the constraints that {\tt value} is frist rounded to the current precision and then clipped to the interval [{\tt minvalue()},{\tt {\bf max\-Value()}{\rm (p.\,\pageref{classKDoubleSpinBox_a12})}}]. \item\end{CompactList}\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf value\-Changed} (double value)
\begin{CompactList}\small\item\em Emitted whenever {\bf QSpin\-Box::value\-Changed}( int ) is emitted. \item\end{CompactList}\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KDouble\-Spin\-Box} ({\bf QWidget} $\ast$parent=0, const  char $\ast$name=0)
\begin{CompactList}\small\item\em Constructs a {\bf KDouble\-Spin\-Box}{\rm (p.\,\pageref{classKDoubleSpinBox})} with parent {\tt parent} and default values for range and value (whatever {\bf QRange\-Control} uses) and precision (2). \item\end{CompactList}\item 
{\bf KDouble\-Spin\-Box} (double lower, double upper, double step, double value, int precision=2, {\bf QWidget} $\ast$parent=0, const  char $\ast$name=0)
\begin{CompactList}\small\item\em Constructs a {\bf KDouble\-Spin\-Box}{\rm (p.\,\pageref{classKDoubleSpinBox})} with parent {\tt parent}, range [{\tt lower},{\tt upper}], {\bf line\-Step}{\rm (p.\,\pageref{classKDoubleSpinBox_a14})} {\tt step}, {\bf precision}{\rm (p.\,\pageref{classKDoubleSpinBox_a6})} {\tt precision} and initial value {\tt value}. \item\end{CompactList}\item 
bool {\bf accept\-Localized\-Numbers} () const 
\item 
virtual void {\bf set\-Accept\-Localized\-Numbers} (bool accept)
\begin{CompactList}\small\item\em Sets whether to use and accept localized numbers as returned by {\bf KLocale::format\-Number}(). \item\end{CompactList}\item 
void {\bf set\-Range} (double lower, double upper, double step=0.01, int precision=2)
\begin{CompactList}\small\item\em Sets a new range for the spin box values. \item\end{CompactList}\item 
int {\bf precision} () const 
\item 
void {\bf set\-Precision} (int precision)
\begin{CompactList}\small\item\em Equivalent to set\-Precsion( {\tt precison}, {\tt false} ); Needed since Qt's moc doesn't ignore trailing parameters with default args when searching for a property setter method. \item\end{CompactList}\item 
virtual void {\bf set\-Precision} (int precision, bool force)
\begin{CompactList}\small\item\em Sets the number of decimal points to use. \item\end{CompactList}\item 
double {\bf value} () const 
\item 
double {\bf min\-Value} () const 
\item 
void {\bf set\-Min\-Value} (double value)
\begin{CompactList}\small\item\em Sets the lower bound of the range to {\tt value}, subject to the contraints that {\tt value} is first rounded to the current precision and then clipped to the maximum representable interval. \item\end{CompactList}\item 
double {\bf max\-Value} () const 
\item 
void {\bf set\-Max\-Value} (double value)
\begin{CompactList}\small\item\em Sets the upper bound of the range to {\tt value}, subject to the contraints that {\tt value} is first rounded to the current precision and then clipped to the maximum representable interval. \item\end{CompactList}\item 
double {\bf line\-Step} () const 
\item 
void {\bf set\-Line\-Step} (double step)
\begin{CompactList}\small\item\em Sets the step size for clicking the up/down buttons to {\tt step}, subject to the constraints that {\tt step} is first rounded to the current precision and then clipped to the meaningful interval [1, {\tt max\-Value} - {\tt min\-Value}]. \item\end{CompactList}\item 
void {\bf set\-Validator} (const  {\bf QValidator} $\ast$)
\begin{CompactList}\small\item\em Overridden to ignore any {\bf set\-Validator()}{\rm (p.\,\pageref{classKDoubleSpinBox_a16})} calls. \item\end{CompactList}\end{CompactItemize}
\subsection*{Protected Slots}
\begin{CompactItemize}
\item 
void {\bf slot\-Value\-Changed} (int value)\label{classKDoubleSpinBox_j0}

\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual {\bf QString} {\bf map\-Value\-To\-Text} (int)\label{classKDoubleSpinBox_b0}

\item 
virtual int {\bf map\-Text\-To\-Value} (bool $\ast$)\label{classKDoubleSpinBox_b1}

\item 
virtual void {\bf virtual\_\-hook} (int id, void $\ast$data)\label{classKDoubleSpinBox_b2}

\end{CompactItemize}


\subsection{Detailed Description}
This class provides a spin box for fractional numbers. A spin box for fractional numbers. 

{\bf  Parameters}

{\bf  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.}

{\bf  \begin{itemize}
\item precision: The number of decimals after the decimal point. \item max\-Value/min\-Value: upper and lower bound of the valid range \item line\-Step: the size of the step that is taken when the user hits the up or down buttons\end{itemize}
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: \small\begin{alltt}
   max( abs({\bf minValue()}{\rm (p.\,\pageref{classKDoubleSpinBox_a10})}), abs({\bf maxValue()}{\rm (p.\,\pageref{classKDoubleSpinBox_a12})} ) $<$= INT\_MAX/10^precision
   maxPrecision = floor( log10( INT\_MAX/max(abs({\bf minValue()}{\rm (p.\,\pageref{classKDoubleSpinBox_a10})}),abs({\bf maxValue()}{\rm (p.\,\pageref{classKDoubleSpinBox_a12})})) ) )
   \end{alltt}\normalsize 
}

{\bf  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 {\em not\/} equivalent (try it!):}

{\bf  \small\begin{alltt}
   // 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 );\end{alltt}\normalsize 
}

{\bf \small\begin{alltt}   // 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 );
   \end{alltt}\normalsize 
}

{\bf }

{\bf \begin{Desc}
\item[Author:]Marc Mutz $<${\tt mutz@kde.org}$>$ \end{Desc}
\begin{Desc}
\item[Version:]\begin{Desc}
\item[Id]{\bf knuminput.h}{\rm (p.\,\pageref{knuminput_8h})},v 1.44 2002/09/28 15:16:22 tjansen Exp \end{Desc}
\end{Desc}
\begin{Desc}
\item[Since:]3.1 \end{Desc}
}



Definition at line 834 of file knuminput.h.

\subsection{Constructor \& Destructor Documentation}
\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!KDoubleSpinBox@{KDoubleSpinBox}}
\index{KDoubleSpinBox@{KDoubleSpinBox}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KDouble\-Spin\-Box::KDouble\-Spin\-Box ({\bf QWidget} $\ast$ {\em parent} = 0, const char $\ast$ {\em name} = 0)}\label{classKDoubleSpinBox_a0}


Constructs a {\bf KDouble\-Spin\-Box}{\rm (p.\,\pageref{classKDoubleSpinBox})} with parent {\tt parent} and default values for range and value (whatever {\bf QRange\-Control} uses) and precision (2). 



Definition at line 912 of file knuminput.cpp.

References QSpin\-Box::editor(), and KStd\-Accel::name().\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!KDoubleSpinBox@{KDoubleSpinBox}}
\index{KDoubleSpinBox@{KDoubleSpinBox}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KDouble\-Spin\-Box::KDouble\-Spin\-Box (double {\em lower}, double {\em upper}, double {\em step}, double {\em value}, int {\em precision} = 2, {\bf QWidget} $\ast$ {\em parent} = 0, const char $\ast$ {\em name} = 0)}\label{classKDoubleSpinBox_a1}


Constructs a {\bf KDouble\-Spin\-Box}{\rm (p.\,\pageref{classKDoubleSpinBox})} with parent {\tt parent}, range [{\tt lower},{\tt upper}], {\bf line\-Step}{\rm (p.\,\pageref{classKDoubleSpinBox_a14})} {\tt step}, {\bf precision}{\rm (p.\,\pageref{classKDoubleSpinBox_a6})} {\tt precision} and initial value {\tt value}. 



Definition at line 920 of file knuminput.cpp.

References QSpin\-Box::editor(), KStd\-Accel::name(), set\-Range(), set\-Value(), and value\-Changed().

\subsection{Member Function Documentation}
\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!acceptLocalizedNumbers@{acceptLocalizedNumbers}}
\index{acceptLocalizedNumbers@{acceptLocalizedNumbers}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool KDouble\-Spin\-Box::accept\-Localized\-Numbers () const}\label{classKDoubleSpinBox_a3}


\begin{Desc}
\item[Returns:]whether the spinbox uses localized numbers \end{Desc}


Definition at line 936 of file knuminput.cpp.\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!setAcceptLocalizedNumbers@{setAcceptLocalizedNumbers}}
\index{setAcceptLocalizedNumbers@{setAcceptLocalizedNumbers}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDouble\-Spin\-Box::set\-Accept\-Localized\-Numbers (bool {\em accept})\hspace{0.3cm}{\tt  [virtual]}}\label{classKDoubleSpinBox_a4}


Sets whether to use and accept localized numbers as returned by {\bf KLocale::format\-Number}(). 



Definition at line 942 of file knuminput.cpp.\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!setRange@{setRange}}
\index{setRange@{setRange}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDouble\-Spin\-Box::set\-Range (double {\em lower}, double {\em upper}, double {\em step} = 0.01, int {\em precision} = 2)}\label{classKDoubleSpinBox_a5}


Sets a new range for the spin box values. 

Note that {\tt lower}, {\tt upper} and {\tt step} are rounded to {\tt precision} decimal points first. 

Definition at line 947 of file knuminput.cpp.

References set\-Line\-Step(), set\-Max\-Value(), set\-Min\-Value(), and set\-Precision().

Referenced by KDouble\-Spin\-Box().\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!precision@{precision}}
\index{precision@{precision}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KDouble\-Spin\-Box::precision () const}\label{classKDoubleSpinBox_a6}


\begin{Desc}
\item[Returns:]the current number of decimal points displayed. \end{Desc}


Definition at line 957 of file knuminput.cpp.\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!setPrecision@{setPrecision}}
\index{setPrecision@{setPrecision}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDouble\-Spin\-Box::set\-Precision (int {\em precision})}\label{classKDoubleSpinBox_a7}


Equivalent to set\-Precsion( {\tt precison}, {\tt false} ); 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.

Referenced by set\-Range().\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!setPrecision@{setPrecision}}
\index{setPrecision@{setPrecision}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDouble\-Spin\-Box::set\-Precision (int {\em precision}, bool {\em force})\hspace{0.3cm}{\tt  [virtual]}}\label{classKDoubleSpinBox_a8}


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. \begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em precision}]the new number of decimal points to use\item[{\em force}]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. {\bf set\-Range}{\rm (p.\,\pageref{classKDoubleSpinBox_a5})}() does. \end{description}
\end{Desc}


Definition at line 965 of file knuminput.cpp.\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!value@{value}}
\index{value@{value}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double KDouble\-Spin\-Box::value () const}\label{classKDoubleSpinBox_a9}


\begin{Desc}
\item[Returns:]the current value \end{Desc}


Reimplemented from {\bf QSpin\-Box}.

Definition at line 987 of file knuminput.cpp.

Referenced by set\-Value().\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!minValue@{minValue}}
\index{minValue@{minValue}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double KDouble\-Spin\-Box::min\-Value () const}\label{classKDoubleSpinBox_a10}


\begin{Desc}
\item[Returns:]the current lower bound \end{Desc}


Reimplemented from {\bf QSpin\-Box}.

Definition at line 1004 of file knuminput.cpp.

Referenced by set\-Line\-Step(), and set\-Value().\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!setMinValue@{setMinValue}}
\index{setMinValue@{setMinValue}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDouble\-Spin\-Box::set\-Min\-Value (double {\em value})}\label{classKDoubleSpinBox_a11}


Sets the lower bound of the range to {\tt value}, subject to the contraints that {\tt value} is first rounded to the current precision and then clipped to the maximum representable interval. 

\begin{Desc}
\item[See also:]{\bf max\-Value}{\rm (p.\,\pageref{classKDoubleSpinBox_a12})}, {\bf min\-Value}{\rm (p.\,\pageref{classKDoubleSpinBox_a10})}, {\bf set\-Max\-Value}{\rm (p.\,\pageref{classKDoubleSpinBox_a13})}, {\bf set\-Range}{\rm (p.\,\pageref{classKDoubleSpinBox_a5})} \end{Desc}


Definition at line 1008 of file knuminput.cpp.

Referenced by set\-Range().\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!maxValue@{maxValue}}
\index{maxValue@{maxValue}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double KDouble\-Spin\-Box::max\-Value () const}\label{classKDoubleSpinBox_a12}


\begin{Desc}
\item[Returns:]the current upper bound \end{Desc}


Reimplemented from {\bf QSpin\-Box}.

Definition at line 1017 of file knuminput.cpp.

Referenced by set\-Line\-Step(), and set\-Value().\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!setMaxValue@{setMaxValue}}
\index{setMaxValue@{setMaxValue}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDouble\-Spin\-Box::set\-Max\-Value (double {\em value})}\label{classKDoubleSpinBox_a13}


Sets the upper bound of the range to {\tt value}, subject to the contraints that {\tt value} is first rounded to the current precision and then clipped to the maximum representable interval. 

\begin{Desc}
\item[See also:]{\bf min\-Value}{\rm (p.\,\pageref{classKDoubleSpinBox_a10})}, {\bf max\-Value}{\rm (p.\,\pageref{classKDoubleSpinBox_a12})}, {\bf set\-Min\-Value}{\rm (p.\,\pageref{classKDoubleSpinBox_a11})}, {\bf set\-Range}{\rm (p.\,\pageref{classKDoubleSpinBox_a5})} \end{Desc}


Definition at line 1021 of file knuminput.cpp.

Referenced by set\-Range().\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!lineStep@{lineStep}}
\index{lineStep@{lineStep}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}double KDouble\-Spin\-Box::line\-Step () const}\label{classKDoubleSpinBox_a14}


\begin{Desc}
\item[Returns:]the current step size \end{Desc}


Reimplemented from {\bf QSpin\-Box}.

Definition at line 1029 of file knuminput.cpp.\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!setLineStep@{setLineStep}}
\index{setLineStep@{setLineStep}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDouble\-Spin\-Box::set\-Line\-Step (double {\em step})}\label{classKDoubleSpinBox_a15}


Sets the step size for clicking the up/down buttons to {\tt step}, subject to the constraints that {\tt step} is first rounded to the current precision and then clipped to the meaningful interval [1, {\tt max\-Value} - {\tt min\-Value}]. 



Definition at line 1033 of file knuminput.cpp.

References max\-Value(), and min\-Value().

Referenced by set\-Range().\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!setValidator@{setValidator}}
\index{setValidator@{setValidator}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDouble\-Spin\-Box::set\-Validator (const {\bf QValidator} $\ast$)}\label{classKDoubleSpinBox_a16}


Overridden to ignore any {\bf set\-Validator()}{\rm (p.\,\pageref{classKDoubleSpinBox_a16})} calls. 



Reimplemented from {\bf QSpin\-Box}.

Definition at line 1063 of file knuminput.cpp.\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!valueChanged@{valueChanged}}
\index{valueChanged@{valueChanged}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDouble\-Spin\-Box::value\-Changed (double {\em value})\hspace{0.3cm}{\tt  [signal]}}\label{classKDoubleSpinBox_l0}


Emitted whenever {\bf QSpin\-Box::value\-Changed}( int ) is emitted. 



Referenced by KDouble\-Spin\-Box().\index{KDoubleSpinBox@{KDouble\-Spin\-Box}!setValue@{setValue}}
\index{setValue@{setValue}!KDoubleSpinBox@{KDouble\-Spin\-Box}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KDouble\-Spin\-Box::set\-Value (double {\em value})\hspace{0.3cm}{\tt  [virtual, slot]}}\label{classKDoubleSpinBox_i0}


Sets the current value to {\tt value}, cubject to the constraints that {\tt value} is frist rounded to the current precision and then clipped to the interval [{\tt minvalue()},{\tt {\bf max\-Value()}{\rm (p.\,\pageref{classKDoubleSpinBox_a12})}}]. 



Definition at line 991 of file knuminput.cpp.

References max\-Value(), min\-Value(), and value().

Referenced by KDouble\-Spin\-Box().

The documentation for this class was generated from the following files:\begin{CompactItemize}
\item 
knuminput.h\item 
knuminput.cpp\end{CompactItemize}
