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


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

Inheritance diagram for KDouble\-Spin\-Box:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=64pt]{classKDoubleSpinBox__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KDouble\-Spin\-Box:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=64pt]{classKDoubleSpinBox__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
virtual void {\bf set\-Value} (double value)
\end{CompactItemize}
\subsection*{Signals}
\begin{CompactItemize}
\item 
void {\bf value\-Changed} (double value)
\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KDouble\-Spin\-Box} ({\bf QWidget} $\ast$parent=0, const char $\ast$name=0)
\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)
\item 
bool {\bf accept\-Localized\-Numbers} () const 
\item 
virtual void {\bf set\-Accept\-Localized\-Numbers} (bool accept)
\item 
void {\bf set\-Range} (double lower, double upper, double step=0.01, int precision=2)
\item 
int {\bf precision} () const 
\item 
void {\bf set\-Precision} (int precision)
\item 
virtual void {\bf set\-Precision} (int precision, bool force)
\item 
double {\bf value} () const 
\item 
double {\bf min\-Value} () const 
\item 
void {\bf set\-Min\-Value} (double value)
\item 
double {\bf max\-Value} () const 
\item 
void {\bf set\-Max\-Value} (double value)
\item 
double {\bf line\-Step} () const 
\item 
void {\bf set\-Line\-Step} (double step)
\item 
void {\bf set\-Validator} (const {\bf QValidator} $\ast$)
\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*{Properties}
\begin{CompactItemize}
\item 
bool {\bf accept\-Localized\-Numbers}\label{classKDoubleSpinBox_00}

\item 
int {\bf precision}\label{classKDoubleSpinBox_01}

\end{CompactItemize}


\subsection{Detailed Description}
A spin box for fractional numbers. 

This class provides a spin box for fractional numbers.

 See below for code examples on how to use this class.

{\bf Parameters} \par


To make successful use of KDouble\-Spin\-Box, you need to understand the relationship between precision and available range.

\begin{itemize}
\item precision: The number of digits after the decimal point. \item max\-Value/min\-Value: upper and lower bounds of the valid range \item line\-Step: the size of the step that is made 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 relationships hold: 

\footnotesize\begin{verbatim}   max( abs(minValue()), abs(maxValue() ) <= INT_MAX/10^precision
   maxPrecision = floor( log10( INT_MAX/max(abs(minValue()),abs(maxValue())) ) )
\end{verbatim}
\normalsize


Since the value, bounds and line\-Step are rounded to the current precision, you may find that the order of setting these parameters matters. As an example, the following are {\em not\/} equivalent (try it!):



\footnotesize\begin{verbatim}   // 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 );
\end{verbatim}
\normalsize


\begin{Desc}
\item[Author:]Marc Mutz $<${\tt mutz@kde.org}$>$ \end{Desc}
\begin{Desc}
\item[Version:]\$Id\$ \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} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0})}\label{classKDoubleSpinBox_a0}


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



Definition at line 996 of file knuminput.cpp.

References QSpin\-Box::editor(), and value\-Changed().\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} = {\tt 2}, {\bf QWidget} $\ast$ {\em parent} = {\tt 0}, const char $\ast$ {\em name} = {\tt 0})}\label{classKDoubleSpinBox_a1}


Constructs a KDouble\-Spin\-Box with parent {\tt parent}, range [ {\tt lower}, {\tt upper} ], line\-Step {\tt step}, precision {\tt precision} and initial value {\tt value}. 



Definition at line 1005 of file knuminput.cpp.

References QSpin\-Box::editor(), 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}
\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 1027 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} = {\tt 0.01}, int {\em precision} = {\tt 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 1032 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 digits displayed to the right of the decimal point. \end{Desc}
\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\-Precision( {\tt precision}, {\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 1046 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 precision (number of digits to the right of the decimal point). 

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.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em precision}]the new precision to use\item[{\em force}]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. \end{description}
\end{Desc}


Definition at line 1050 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 1072 of file knuminput.cpp.

Referenced by KInput\-Dialog::get\-Double().\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 1089 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 range interval that can be handled at that precision. 

\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 1093 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 1102 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 range interval that can be handled at that precision. 

\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 1106 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 1114 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 {\bf max\-Value()}{\rm (p.\,\pageref{classKDoubleSpinBox_a12})}} - {\tt {\bf min\-Value()}{\rm (p.\,\pageref{classKDoubleSpinBox_a10})}} ]. 



Definition at line 1118 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 1148 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}, subject to the constraints that {\tt value} is first rounded to the current precision and then clipped to the interval [ {\tt {\bf min\-Value()}{\rm (p.\,\pageref{classKDoubleSpinBox_a10})}} , {\tt {\bf max\-Value()}{\rm (p.\,\pageref{classKDoubleSpinBox_a12})}} ]. 



Definition at line 1076 of file knuminput.cpp.

References max\-Value(), and min\-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}
