class KLed

A round led widget. More...

Definition#include <kled.h>
InheritsQWidget (qt)
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Slots

Protected Methods


Detailed Description

KLed displays a round light emmiting diode.

It is configurable to 5 colors and the 2 on/off states.

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

enum Color {yellow, orange, red, green, blue }

color of the led

enum State {Off=0, On=1 }

Status of the light is on/off

enum Look {flat, round, sunken }

Displays a flat, round or round-sunken led. Displaying the led flat is less time and color consuming, but not so nice to see.

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

timings: ( AMD K5/133, Diamond Stealth 64 PCI Graphics, widgetsize 29x29 ) - flat approx. 0.7 msec per paint - round approx. 2.9 msec per paint - sunken approx. 3.3 msec per paint

The widget will be updated the next repaining event.

 KLed ( KLed::Color ledcolor, QWidget *parent = 0, const char *name = 0 )

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

The State will be defaulted On and the Look round

Parameters:
ledcolorinitializes with Color
parentwill be handed over to QWidget
namewill be handed over to QWidget

 KLed ( KLed::Color ledcolor, KLed::State state, KLed::Look look, QWidget *parent = 0, const char *name = 0 )

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

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

Parameters:
ledcolorinitializes with Color
statesets the State
looksets the Look
parentwill be handed over to QWidget
namewill be handed over to QWidget

inline State  getState ()

[const]

Hands back the current state of the widget (on/off) see enum State

inline Color  getColor ()

[const]

Hands back the color of the widget see enum Color

inline QRgb  getRgbColor ()

[const]

Hands back the color of the widget in RGB value. The value depends on the state of the the led (on, off) see QRgb

inline Look  getLook ()

[const]

Hands back the look of the widget see enum Look

inline void  setState ( State state )

sets the state of the widget to On or Off. The widget will be painted immediately. see also: on(), off(), toggle(), toggleState()

Parameters:
statethe led state on or off

inline void  toggleState ()

toggles the state of the led from Off to On and vice versa. The widget will be repainted when returning to the main event loop.

inline void  setColor ( KLed::Color color )

Sets the color of the widget. The widget calls the update method, so it will be updated when entering the main event loop.

see also: enum Color

Parameters:
colornew Color of the led

inline void  setLook ( Look 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: enum Look

Parameters:
looknew look of the led

inline void  toggle ()

[slot]

toggles the state of the led from Off to On an vice versa. The widget repaints itself immediately.

inline void  on ()

[slot]

sets the state of the widget to On. The widget will be painted immediately. see off(), toggle(), toggleState(), setState()

inline void  off ()

[slot]

sets the state of the widget to Off. The widget will be painted immediately. see also: on(), toggle(), toggleState(), setState()