KLed Class Reference
An LED widget.
More...
#include <kled.h>
List of all members.
Detailed Description
An LED widget.
Displays a round or rectangular light emitting diode.
It is configurable to arbitrary 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.
KDE LED Widget
- Author:
- Joerg Habenicht, Richard J. Moore (rich@kde.org) 1998, 1999
Definition at line 44 of file kled.h.
Member Enumeration Documentation
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.
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.
LED look.
- Enumerator:
-
Definition at line 88 of file kled.h.
Shades of the lamp.
LED shape
- Enumerator:
-
Definition at line 66 of file kled.h.
Status of the light is on/off.
LED on/off.
- Enumerator:
-
Definition at line 60 of file kled.h.
Constructor & Destructor Documentation
KLed::KLed |
( |
QWidget * |
parent = 0 |
) |
[explicit] |
Constructs a green, round LED widget which will initially be turned on.
- Parameters:
-
| parent | The parent widget. |
Definition at line 66 of file kled.cpp.
KLed::KLed |
( |
const QColor & |
color, |
|
|
QWidget * |
parent = 0 | |
|
) |
| | [explicit] |
Constructs a round LED widget with the supplied color which will initially be turned on.
- Parameters:
-
| color | Initial color of the LED. |
| parent | The parent widget. Constructor |
Definition at line 74 of file kled.cpp.
Constructor with the color, state and look.
Differs from above only in the parameters, which configure all settings.
- Parameters:
-
| color | Initial color of the LED. |
| state | Sets the State. |
| look | Sets the Look. |
| shape | Sets the Shape (rectangular or circular). |
| parent | The parent widget. Constructor |
Definition at line 81 of file kled.cpp.
Destroys the LED widget.
Destructor
Definition at line 93 of file kled.cpp.
Member Function Documentation
Returns the current color of the widget.
- See also:
- Color Returns LED color.
int KLed::darkFactor |
( |
|
) |
const |
Returns the factor to darken the LED.
- See also:
- setDarkFactor() Returns dark factor.
int KLed::ledWidth |
( |
|
) |
const [protected, virtual] |
Returns the width of the led.
Definition at line 149 of file kled.cpp.
Look KLed::look |
( |
|
) |
const |
Returns the current look of the widget.
- See also:
- Look Returns LED look.
QSize KLed::minimumSizeHint |
( |
|
) |
const [virtual] |
void KLed::off |
( |
|
) |
[slot] |
bool KLed::paintCachedPixmap |
( |
|
) |
[protected] |
Paint the cached antialiased pixmap corresponding to the state if any.
- Returns:
- true if the pixmap was painted, false if it hasn't been created yet
Definition at line 167 of file kled.cpp.
void KLed::paintFlat |
( |
|
) |
[protected, virtual] |
Paints a circular, flat LED.
Definition at line 187 of file kled.cpp.
void KLed::paintRaised |
( |
|
) |
[protected, virtual] |
Paints a circular, raised LED.
Definition at line 245 of file kled.cpp.
void KLed::paintRect |
( |
|
) |
[protected, virtual] |
Paints a rectangular, flat LED.
Definition at line 461 of file kled.cpp.
void KLed::paintRectFrame |
( |
bool |
raised |
) |
[protected, virtual] |
Paints a rectangular LED, either raised or sunken, depending on its argument.
Definition at line 495 of file kled.cpp.
void KLed::paintSunken |
( |
|
) |
[protected, virtual] |
Paints a circular, sunken LED.
Definition at line 347 of file kled.cpp.
void KLed::setColor |
( |
const QColor & |
color |
) |
|
Set the color of the widget.
The LED is shown with Color when in the KLed::On state or with the darken Color (
- See also:
- setDarkFactor) in KLed::Off state.
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. Sets the LED color. |
Definition at line 560 of file kled.cpp.
void KLed::setDarkFactor |
( |
int |
darkFactor |
) |
|
Sets the factor to darken the LED in KLed::Off state.
The
- Parameters:
-
| darkFactor | should be greater than 100, otherwise the LED becomes lighter in KLed::Off state. |
Defaults to 300.
- See also:
- QColor
- Parameters:
-
| darkFactor | Sets the factor to darken the LED. Sets the factor to darken the LED. |
Definition at line 581 of file kled.cpp.
void KLed::setLook |
( |
Look |
look |
) |
|
Sets the look of the widget.
The look may be Flat, Raised 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. Sets LED look. |
Definition at line 596 of file kled.cpp.
void KLed::setShape |
( |
Shape |
shape |
) |
|
Set the shape of the LED.
- Parameters:
-
| shape | The LED shape. Set LED shape. |
Definition at line 551 of file kled.cpp.
void KLed::setState |
( |
State |
state |
) |
|
Sets the state of the widget to On or Off.
The widget will be painted immediately.
- See also:
- on() off() toggle()
- Parameters:
-
| state | The LED state: on or off. Set LED state. |
Definition at line 542 of file kled.cpp.
Shape KLed::shape |
( |
|
) |
const |
Returns the current shape of the widget.
- See also:
- Shape Returns LED shape.
QSize KLed::sizeHint |
( |
void |
|
) |
const [virtual] |
State KLed::state |
( |
|
) |
const |
Returns the current state of the widget (on/off).
- See also:
- State Returns LED state.
void KLed::toggle |
( |
|
) |
[slot] |
Toggles the state of the led from Off to On or vice versa.
The widget repaints itself immediately.
Definition at line 605 of file kled.cpp.
Property Documentation
QColor KLed::color [read, write] |
int KLed::darkFactor [read, write] |
The documentation for this class was generated from the following files: