\section{KLed Class Reference}
\label{classKLed}\index{KLed@{KLed}}
Displays a round or rectangular light emitting diode. An LED widget.  


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

Inheritance diagram for KLed:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=45pt]{classKLed__inherit__graph}
\end{center}
\end{figure}
Collaboration diagram for KLed:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=93pt]{classKLed__coll__graph}
\end{center}
\end{figure}
\subsection*{Public Types}
\begin{CompactItemize}
\item 
enum {\bf State} \{ {\bf Off}, 
{\bf On}
 \}
\begin{CompactList}\small\item\em Status of the light is on/off. LED on/off. \item\end{CompactList}\item 
enum {\bf Shape} \{ {\bf Rectangular}, 
{\bf Circular}
 \}
\begin{CompactList}\small\item\em Shades of the lamp. LED shape. \item\end{CompactList}\item 
enum {\bf Look} \{ {\bf Flat}, 
{\bf Raised}, 
{\bf Sunken}
 \}
\begin{CompactList}\small\item\em Displays a flat, round or sunken LED. LED look. \item\end{CompactList}\end{CompactItemize}
\subsection*{Public Slots}
\begin{CompactItemize}
\item 
void {\bf toggle} ()
\begin{CompactList}\small\item\em Toggles the state of the led from Off to On or vice versa. \item\end{CompactList}\item 
void {\bf on} ()
\begin{CompactList}\small\item\em Sets the state of the widget to On. \item\end{CompactList}\item 
void {\bf off} ()
\begin{CompactList}\small\item\em Sets the state of the widget to Off. \item\end{CompactList}\end{CompactItemize}
\subsection*{Public Member Functions}
\begin{CompactItemize}
\item 
{\bf KLed} ({\bf QWidget} $\ast$parent=0, const  char $\ast$name=0)
\begin{CompactList}\small\item\em Constructs a green, round LED widget which will initially be turned on. \item\end{CompactList}\item 
{\bf KLed} (const  {\bf QColor} \&col=Qt::green, {\bf QWidget} $\ast$parent=0, const  char $\ast$name=0)
\begin{CompactList}\small\item\em Constructor with the ledcolor, the parent widget, and the name. Constructor. \item\end{CompactList}\item 
{\bf KLed} (const  {\bf QColor} \&col, {\bf KLed::State} st, {\bf KLed::Look} look, {\bf KLed::Shape} shape, {\bf QWidget} $\ast$parent=0, const  char $\ast$name=0)
\begin{CompactList}\small\item\em Constructor with the ledcolor, ledstate, ledlook, the parent widget, and the name. Constructor. \item\end{CompactList}\item 
{\bf $\sim$KLed} ()
\begin{CompactList}\small\item\em Destructor Destructor. \item\end{CompactList}\item 
{\bf State} {\bf state} () const 
\begin{CompactList}\small\item\em Returns the current state of the widget (on/off). Returns LED state. \item\end{CompactList}\item 
{\bf Shape} {\bf shape} () const \label{classKLed_a5}

\item 
{\bf QColor} {\bf color} () const 
\begin{CompactList}\small\item\em Returns the color of the widget Returns LED color. \item\end{CompactList}\item 
{\bf Look} {\bf look} () const 
\begin{CompactList}\small\item\em Returns the look of the widget. Returns LED look. \item\end{CompactList}\item 
int {\bf dark\-Factor} () const 
\begin{CompactList}\small\item\em Returns the factor to darken the LED. Returns dark factor. \item\end{CompactList}\item 
void {\bf set\-State} ({\bf State} state)
\begin{CompactList}\small\item\em Sets the state of the widget to On or Off. Set LED state. \item\end{CompactList}\item 
void {\bf set\-Shape} ({\bf Shape} s)
\begin{CompactList}\small\item\em Set the shape of the LED to {\tt s}. \item\end{CompactList}\item 
void {\bf toggle\-State} ()
\begin{CompactList}\small\item\em Toggle the state of the LED from Off to On and vice versa. Toggles LED on-$>$off / off-$>$on. {\bf This class or method is obsolete, it is provided for compatibility only.}, use {\bf toggle()}{\rm (p.\,\pageref{classKLed_i0})} instead. \item\end{CompactList}\item 
void {\bf set\-Color} (const  {\bf QColor} \&color)
\begin{CompactList}\small\item\em Set the color of the widget. Sets the LED color. \item\end{CompactList}\item 
void {\bf set\-Dark\-Factor} (int darkfactor)
\begin{CompactList}\small\item\em Sets the factor to darken the LED in OFF state. sets the factor to darken the LED. \item\end{CompactList}\item 
void {\bf set\-Look} ({\bf Look} look)
\begin{CompactList}\small\item\em Sets the look of the widget. Sets LED look. \item\end{CompactList}\item 
virtual {\bf QSize} {\bf size\-Hint} () const \label{classKLed_a15}

\item 
virtual {\bf QSize} {\bf minimum\-Size\-Hint} () const \label{classKLed_a16}

\end{CompactItemize}
\subsection*{Protected Member Functions}
\begin{CompactItemize}
\item 
virtual void {\bf paint\-Flat} ()
\begin{CompactList}\small\item\em Paints a circular, flat LED. \item\end{CompactList}\item 
virtual void {\bf paint\-Round} ()
\begin{CompactList}\small\item\em Paints a circular, raised LED. \item\end{CompactList}\item 
virtual void {\bf paint\-Sunken} ()
\begin{CompactList}\small\item\em Paints a circular, sunken LED. \item\end{CompactList}\item 
virtual void {\bf paint\-Rect} ()
\begin{CompactList}\small\item\em Paints a rectangular, flat LED. \item\end{CompactList}\item 
virtual void {\bf paint\-Rect\-Frame} (bool raised)
\begin{CompactList}\small\item\em Paints a rectangular LED, either raised or sunken, depending on its argument. \item\end{CompactList}\item 
void {\bf paint\-Event} ({\bf QPaint\-Event} $\ast$)\label{classKLed_b5}

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

\end{CompactItemize}


\subsection{Detailed Description}
Displays a round or rectangular light emitting diode. An LED widget. 

It is configurable to five colors, the two on/off states and three styles (or \char`\"{}looks\char`\"{});

It may display itself in a performant flat view, a round view with light spot or a round view sunken in the screen.

\begin{Desc}
\item[Author:]Joerg Habenicht, Richard J. Moore ({\tt rich@kde.org}) 1998, 1999 \end{Desc}




Definition at line 41 of file kled.h.

\subsection{Member Enumeration Documentation}
\index{KLed@{KLed}!State@{State}}
\index{State@{State}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KLed::State}}\label{classKLed_w7}


Status of the light is on/off. LED on/off. 



Definition at line 57 of file kled.h.\index{KLed@{KLed}!Shape@{Shape}}
\index{Shape@{Shape}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KLed::Shape}}\label{classKLed_w8}


Shades of the lamp. LED shape. 



Definition at line 63 of file kled.h.\index{KLed@{KLed}!Look@{Look}}
\index{Look@{Look}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf enum} {\bf KLed::Look}}\label{classKLed_w9}


Displays a flat, round or sunken LED. LED look. 

Displaying the LED flat is less time and color consuming, but not so nice to see.

The sunken LED itself is (certainly) smaller than the round LED because of the 3 shading circles and is most time consuming. Makes sense for LED $>$ 15x15 pixels.

{\bf  Timings: ( AMD K5/133, Diamond Stealth 64 PCI Graphics, widgetsize 29x29 ) \begin{itemize}
\item flat Approximately 0.7 msec per paint \item round Approximately 2.9 msec per paint \item sunken Approximately 3.3 msec per paint\end{itemize}
The widget will be updated on the next repaining event.}

{\bf }

{\bf  }

Definition at line 85 of file kled.h.

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


Constructs a green, round LED widget which will initially be turned on. 



Definition at line 134 of file kled.cpp.

References QColor::dark(), KStd\-Accel::name(), and set\-Color().\index{KLed@{KLed}!KLed@{KLed}}
\index{KLed@{KLed}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KLed::KLed (const {\bf QColor} \& {\em col} = Qt::green, {\bf QWidget} $\ast$ {\em parent} = 0, const char $\ast$ {\em name} = 0)}\label{classKLed_a1}


Constructor with the ledcolor, the parent widget, and the name. Constructor. 

The State will be defaulted On and the Look round.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ledcolor}]Initial color of the LED. \item[{\em parent}]Will be handed over to {\bf QWidget}. \item[{\em name}]Will be handed over to {\bf QWidget}. \end{description}
\end{Desc}


Definition at line 149 of file kled.cpp.

References QColor::dark(), KStd\-Accel::name(), and set\-Color().\index{KLed@{KLed}!KLed@{KLed}}
\index{KLed@{KLed}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KLed::KLed (const {\bf QColor} \& {\em col}, {\bf KLed::State} {\em st}, {\bf KLed::Look} {\em look}, {\bf KLed::Shape} {\em shape}, {\bf QWidget} $\ast$ {\em parent} = 0, const char $\ast$ {\em name} = 0)}\label{classKLed_a2}


Constructor with the ledcolor, ledstate, ledlook, the parent widget, and the name. Constructor. 

Differs from above only in the parameters, which configure all settings.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em ledcolor}]Initial color of the LED. \item[{\em state}]Sets the State. \item[{\em look}]Sets the Look. \item[{\em parent}]Will be handed over to {\bf QWidget}. \item[{\em name}]Will be handed over to {\bf QWidget}. \end{description}
\end{Desc}


Definition at line 163 of file kled.cpp.

References QColor::dark(), KStd\-Accel::name(), and set\-Color().\index{KLed@{KLed}!~KLed@{$\sim$KLed}}
\index{~KLed@{$\sim$KLed}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}KLed::$\sim${\bf KLed} ()}\label{classKLed_a3}


Destructor Destructor. 



Definition at line 179 of file kled.cpp.

\subsection{Member Function Documentation}
\index{KLed@{KLed}!state@{state}}
\index{state@{state}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KLed::State} KLed::state () const}\label{classKLed_a4}


Returns the current state of the widget (on/off). Returns LED state. 

\begin{Desc}
\item[See also:]{\bf State}{\rm (p.\,\pageref{classKLed_w7})} \end{Desc}


Definition at line 540 of file kled.cpp.\index{KLed@{KLed}!color@{color}}
\index{color@{color}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf QColor} KLed::color () const}\label{classKLed_a6}


Returns the color of the widget Returns LED color. 

\begin{Desc}
\item[See also:]Color \end{Desc}


Definition at line 552 of file kled.cpp.

Referenced by paint\-Flat(), paint\-Round(), and paint\-Sunken().\index{KLed@{KLed}!look@{look}}
\index{look@{look}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf KLed::Look} KLed::look () const}\label{classKLed_a7}


Returns the look of the widget. Returns LED look. 

\begin{Desc}
\item[See also:]{\bf Look}{\rm (p.\,\pageref{classKLed_w9})} \end{Desc}


Definition at line 558 of file kled.cpp.\index{KLed@{KLed}!darkFactor@{darkFactor}}
\index{darkFactor@{darkFactor}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}int KLed::dark\-Factor () const}\label{classKLed_a8}


Returns the factor to darken the LED. Returns dark factor. 

\begin{Desc}
\item[See also:]{\bf set\-Dark\-Factor()}{\rm (p.\,\pageref{classKLed_a13})} \end{Desc}


Definition at line 612 of file kled.cpp.\index{KLed@{KLed}!setState@{setState}}
\index{setState@{setState}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::set\-State ({\bf State} {\em state})}\label{classKLed_a9}


Sets the state of the widget to On or Off. Set LED state. 

The widget will be painted immediately. \begin{Desc}
\item[See also:]{\bf on()}{\rm (p.\,\pageref{classKLed_i1})} {\bf off()}{\rm (p.\,\pageref{classKLed_i2})} {\bf toggle()}{\rm (p.\,\pageref{classKLed_i0})} {\bf toggle\-State()}{\rm (p.\,\pageref{classKLed_a11})}\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em state}]The LED state: on or off. \end{description}
\end{Desc}


Definition at line 564 of file kled.cpp.

References QWidget::update().

Referenced by off(), and on().\index{KLed@{KLed}!setShape@{setShape}}
\index{setShape@{setShape}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::set\-Shape ({\bf Shape} {\em s})}\label{classKLed_a10}


Set the shape of the LED to {\tt s}. 



Definition at line 582 of file kled.cpp.

References QWidget::update().\index{KLed@{KLed}!toggleState@{toggleState}}
\index{toggleState@{toggleState}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::toggle\-State ()}\label{classKLed_a11}


Toggle the state of the LED from Off to On and vice versa. Toggles LED on-$>$off / off-$>$on. {\bf This class or method is obsolete, it is provided for compatibility only.}, use {\bf toggle()}{\rm (p.\,\pageref{classKLed_i0})} instead. 

The widget will be repainted when returning to the main event loop. 

Definition at line 574 of file kled.cpp.

References QWidget::update().

Referenced by toggle().\index{KLed@{KLed}!setColor@{setColor}}
\index{setColor@{setColor}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::set\-Color (const {\bf QColor} \& {\em color})}\label{classKLed_a12}


Set the color of the widget. Sets the LED color. 

The Color is shown with the KLed::On state. The KLed::Off state is shown with {\bf QColor.dark()} method

The widget calls the {\bf update()} method, so it will be updated when entering the main event loop.

\begin{Desc}
\item[See also:]Color\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em color}]New color of the LED. \end{description}
\end{Desc}


Definition at line 592 of file kled.cpp.

References QWidget::update().

Referenced by KLed().\index{KLed@{KLed}!setDarkFactor@{setDarkFactor}}
\index{setDarkFactor@{setDarkFactor}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::set\-Dark\-Factor (int {\em darkfactor})}\label{classKLed_a13}


Sets the factor to darken the LED in OFF state. sets the factor to darken the LED. 

Same as {\bf QColor::dark}(). \char`\"{}darkfactor should be greater than 100, else the LED gets lighter in OFF state. Defaults to 300.

\begin{Desc}
\item[See also:]{\bf QColor}\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em darkfactor}]sets the factor to darken the LED. \end{description}
\end{Desc}


Definition at line 602 of file kled.cpp.

References QColor::dark(), and QWidget::update().\index{KLed@{KLed}!setLook@{setLook}}
\index{setLook@{setLook}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::set\-Look ({\bf Look} {\em look})}\label{classKLed_a14}


Sets the look of the widget. Sets LED look. 

The look may be flat, round or sunken. The widget calls the {\bf update()} method, so it will be updated when entering the main event loop.

\begin{Desc}
\item[See also:]{\bf Look}{\rm (p.\,\pageref{classKLed_w9})}\end{Desc}
\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em look}]New look of the LED. \end{description}
\end{Desc}


Definition at line 618 of file kled.cpp.

References QWidget::update().\index{KLed@{KLed}!toggle@{toggle}}
\index{toggle@{toggle}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::toggle ()\hspace{0.3cm}{\tt  [slot]}}\label{classKLed_i0}


Toggles the state of the led from Off to On or vice versa. 

The widget repaints itself immediately. 

Definition at line 628 of file kled.cpp.

References toggle\-State().\index{KLed@{KLed}!on@{on}}
\index{on@{on}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::on ()\hspace{0.3cm}{\tt  [slot]}}\label{classKLed_i1}


Sets the state of the widget to On. 

The widget will be painted immediately. \begin{Desc}
\item[See also:]{\bf off()}{\rm (p.\,\pageref{classKLed_i2})} {\bf toggle()}{\rm (p.\,\pageref{classKLed_i0})} {\bf toggle\-State()}{\rm (p.\,\pageref{classKLed_a11})} {\bf set\-State()}{\rm (p.\,\pageref{classKLed_a9})} \end{Desc}


Definition at line 634 of file kled.cpp.

References set\-State().\index{KLed@{KLed}!off@{off}}
\index{off@{off}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::off ()\hspace{0.3cm}{\tt  [slot]}}\label{classKLed_i2}


Sets the state of the widget to Off. 

The widget will be painted immediately. \begin{Desc}
\item[See also:]{\bf on()}{\rm (p.\,\pageref{classKLed_i1})} {\bf toggle()}{\rm (p.\,\pageref{classKLed_i0})} {\bf toggle\-State()}{\rm (p.\,\pageref{classKLed_a11})} {\bf set\-State()}{\rm (p.\,\pageref{classKLed_a9})} \end{Desc}


Definition at line 640 of file kled.cpp.

References set\-State().\index{KLed@{KLed}!paintFlat@{paintFlat}}
\index{paintFlat@{paintFlat}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::paint\-Flat ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKLed_b0}


Paints a circular, flat LED. 



Definition at line 239 of file kled.cpp.

References QPainter::begin(), color(), QPainter::draw\-Ellipse(), QPainter::end(), QWidget::height(), QPainter::set\-Brush(), QPen::set\-Color(), QBrush::set\-Color(), QPainter::set\-Pen(), QColor::set\-Rgb(), QBrush::set\-Style(), QPen::set\-Width(), and QWidget::width().\index{KLed@{KLed}!paintRound@{paintRound}}
\index{paintRound@{paintRound}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::paint\-Round ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKLed_b1}


Paints a circular, raised LED. 



Definition at line 285 of file kled.cpp.

References QPainter::begin(), color(), QPainter::draw\-Ellipse(), QPainter::end(), QWidget::height(), QColor::light(), QWidget::pos(), QPainter::set\-Brush(), QPen::set\-Color(), QBrush::set\-Color(), QPainter::set\-Pen(), QColor::set\-Rgb(), QBrush::set\-Style(), QPen::set\-Width(), and QWidget::width().\index{KLed@{KLed}!paintSunken@{paintSunken}}
\index{paintSunken@{paintSunken}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::paint\-Sunken ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKLed_b2}


Paints a circular, sunken LED. 



Definition at line 370 of file kled.cpp.

References QPainter::begin(), color(), QPainter::draw\-Arc(), QPainter::draw\-Ellipse(), QPainter::end(), QWidget::height(), QColor::light(), QWidget::pos(), QPainter::set\-Brush(), QPen::set\-Color(), QBrush::set\-Color(), QPainter::set\-Pen(), QColor::set\-Rgb(), QBrush::set\-Style(), QPen::set\-Width(), and QWidget::width().\index{KLed@{KLed}!paintRect@{paintRect}}
\index{paintRect@{paintRect}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::paint\-Rect ()\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKLed_b3}


Paints a rectangular, flat LED. 



Definition at line 477 of file kled.cpp.

References QColor::dark(), QPainter::draw\-Line(), QPainter::draw\-Rect(), QWidget::height(), QPainter::set\-Brush(), QPainter::set\-Pen(), and QWidget::width().\index{KLed@{KLed}!paintRectFrame@{paintRectFrame}}
\index{paintRectFrame@{paintRectFrame}!KLed@{KLed}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KLed::paint\-Rect\-Frame (bool {\em raised})\hspace{0.3cm}{\tt  [protected, virtual]}}\label{classKLed_b4}


Paints a rectangular LED, either raised or sunken, depending on its argument. 



Definition at line 508 of file kled.cpp.

References QPainter::draw\-Line(), QPainter::draw\-Rect(), QPainter::fill\-Rect(), QWidget::height(), QPainter::set\-Pen(), and QWidget::width().

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