Main Page   Modules   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   Related Pages  

KLed Class Reference

An LED widget. More...

#include <kled.h>

List of all members.

Public Types

enum  State
 LED on/off. More...

enum  Shape
 LED shape. More...

enum  Look
 LED look. More...


Public Slots

void toggle ()
void on ()
void off ()

Public Methods

 KLed (QWidget *parent=0, const char *name=0)
 KLed (const QColor &col=Qt::green, QWidget *parent=0, const char *name=0)
 Constructor.

 KLed (const QColor &col, KLed::State st, KLed::Look look, KLed::Shape shape, QWidget *parent=0, const char *name=0)
 Constructor.

 ~KLed ()
 Destructor.

State state () const
 Returns LED state.

QColor color () const
 Returns LED color.

Look look () const
 Returns LED look.

int darkFactor () const
 Returns dark factor.

void setState (State state)
 Set LED state.

void setShape (Shape s)
void toggleState ()
 Toggles LED on->off / off->on.

void setColor (const QColor &color)
 Sets the LED color.

void setDarkFactor (int darkfactor)
 sets the factor to darken the LED.

void setLook (Look look)
 Sets the light and dark LED color. Sets LED look.


Protected Methods

virtual void paintFlat ()
virtual void paintRound ()
virtual void paintSunken ()
virtual void paintRect ()
virtual void paintRectFrame (bool raised)
void paintEvent (QPaintEvent *)


Detailed Description

An LED widget.

Displays a round or rectangular light emitting diode.

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

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

Author:
Joerg Habenicht, Richard J. Moore (rich@kde.org) 1998, 1999

Definition at line 41 of file kled.h.


Member Enumeration Documentation

enum KLed::Look
 

LED look.

Displays a flat, round or sunken LED.

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.

@sect Timings: ( AMD K5/133, Diamond Stealth 64 PCI Graphics, widgetsize 29x29 )

  • flat Approximately 0.7 msec per paint
  • round Approximately 2.9 msec per paint
  • sunken Approximately 3.3 msec per paint
The widget will be updated on the next repaining event.

Definition at line 85 of file kled.h.

enum KLed::Shape
 

LED shape.

Shades of the lamp.

Definition at line 63 of file kled.h.

enum KLed::State
 

LED on/off.

Status of the light is on/off.

Definition at line 57 of file kled.h.


Constructor & Destructor Documentation

KLed::KLed QWidget *    parent = 0,
const char *    name = 0
 

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

KLed::KLed const QColor &    col = Qt::green,
QWidget *    parent = 0,
const char *    name = 0
 

Constructor.

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

The State will be defaulted On and the Look round.

Parameters:
ledcolor  Initial color of the LED.
parent  Will be handed over to QWidget.
name  Will be handed over to QWidget.

KLed::KLed const QColor &    col,
KLed::State    st,
KLed::Look    look,
KLed::Shape    shape,
QWidget *    parent = 0,
const char *    name = 0
 

Constructor.

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

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

Parameters:
ledcolor  Initial color of the LED.
state  Sets the State.
look  Sets the Look.
parent  Will be handed over to QWidget.
name  Will be handed over to QWidget.

KLed::~KLed  
 

Destructor.

Destructor


Member Function Documentation

QColor KLed::color  
 

Returns LED color.

Returns the color of the widget

See also:
Color

int KLed::darkFactor  
 

Returns dark factor.

Returns the factor to darken the LED.

See also:
setDarkFactor()

Look KLed::look  
 

Returns LED look.

Returns the look of the widget.

See also:
Look

void KLed::off   [slot]
 

Sets the state of the widget to Off.

The widget will be painted immediately.

See also:
on() toggle() toggleState() setState()

void KLed::on   [slot]
 

Sets the state of the widget to On.

The widget will be painted immediately.

See also:
off() toggle() toggleState() setState()

void KLed::paintEvent QPaintEvent *    [protected]
 

@reimplemented

virtual void KLed::paintFlat   [protected, virtual]
 

Paints a circular, flat LED.

virtual void KLed::paintRect   [protected, virtual]
 

Paints a rectangular, flat LED.

virtual void KLed::paintRectFrame bool    raised [protected, virtual]
 

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

virtual void KLed::paintRound   [protected, virtual]
 

Paints a circular, raised LED.

virtual void KLed::paintSunken   [protected, virtual]
 

Paints a circular, sunken LED.

void KLed::setColor const QColor &    color
 

Sets the LED color.

Set the color of the widget. The Color is shown with the KLed::On state. The KLed::Off state is shown with QColor.dark() method

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

See also:
Color
Parameters:
color  New color of the LED.

void KLed::setDarkFactor int    darkfactor
 

sets the factor to darken the LED.

Sets the factor to darken the LED in OFF state. Same as QColor::dark(). "darkfactor should be greater than 100, else the LED gets lighter in OFF state. Defaults to 300.

See also:
QColor
Parameters:
darkfactor  sets the factor to darken the LED.

void KLed::setLook Look    look
 

Sets the light and dark LED color. Sets LED look.

Sets the look of the widget.

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

See also:
Look
Parameters:
look  New look of the LED.

void KLed::setShape Shape    s
 

Set the shape of the LED to s.

void KLed::setState State    state
 

Set LED state.

Sets the state of the widget to On or Off.

The widget will be painted immediately.

See also:
on() off() toggle() toggleState()
Parameters:
state  The LED state: on or off.

State KLed::state  
 

Returns LED state.

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

See also:
State

void KLed::toggle   [slot]
 

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

The widget repaints itself immediately.

void KLed::toggleState  
 

Toggles LED on->off / off->on.

Toggle the state of the LED from Off to On and vice versa.

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

Deprecated:
, use toggle() instead.


The documentation for this class was generated from the following file:
Generated on Wed Aug 13 23:30:17 2003 for kdelibs by doxygen1.2.18