|
|
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:
ledcolor | initializes with Color |
parent | will be handed over to QWidget |
name | will 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:
ledcolor | initializes with Color |
state | sets the State |
look | sets the Look |
parent | will be handed over to QWidget |
name | will be handed over to QWidget |
inline State getState () |
Hands back the current state of the widget (on/off) see enum State
inline Color getColor () |
Hands back the color of the widget see enum Color
inline QRgb getRgbColor () |
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 () |
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:
state | the 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:
color | new 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:
look | new look of the led |
inline void toggle () |
toggles the state of the led from Off to On an vice versa. The widget repaints itself immediately.
inline void on () |
sets the state of the widget to On. The widget will be painted immediately. see off(), toggle(), toggleState(), setState()
inline void off () |
sets the state of the widget to Off. The widget will be painted immediately. see also: on(), toggle(), toggleState(), setState()