KLed Class Reference
#include <kled.h>
Inheritance diagram for KLed:

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.

KDE LED Widget
- Author:
- Joerg Habenicht, Richard J. Moore (rich@kde.org) 1998, 1999
Definition at line 45 of file kled.h.
Public Types | |
Off | |
On | |
Rectangular | |
Circular | |
Flat | |
Raised | |
Sunken | |
enum | State { Off, On } |
enum | Shape { Rectangular, Circular } |
enum | Look { Flat, Raised, Sunken } |
Public Slots | |
void | toggle () |
void | on () |
void | off () |
Public Member Functions | |
KLed (QWidget *parent=0, const char *name=0) | |
KLed (const QColor &col, QWidget *parent=0, const char *name=0) | |
KLed (const QColor &col, KLed::State state, KLed::Look look, KLed::Shape shape, QWidget *parent=0, const char *name=0) | |
~KLed () | |
State | state () const |
Shape | shape () const |
QColor | color () const |
Look | look () const |
int | darkFactor () const |
void | setState (State state) |
void | setShape (Shape s) |
void | toggleState () KDE_DEPRECATED |
void | setColor (const QColor &color) |
void | setDarkFactor (int darkfactor) |
void | setLook (Look look) |
virtual QSize | sizeHint () const |
virtual QSize | minimumSizeHint () const |
Protected Member Functions | |
virtual void | paintFlat () |
virtual void | paintRound () |
virtual void | paintSunken () |
virtual void | paintRect () |
virtual void | paintRectFrame (bool raised) |
void | paintEvent (QPaintEvent *) |
int | ensureRoundLed () |
bool | paintCachedPixmap () |
virtual void | virtual_hook (int id, void *data) |
Properties | |
State | state [] |
Shape | shape [] |
Look | look [] |
QColor | color [] |
int | darkFactor [] |
Member Enumeration Documentation
enum KLed::Look |
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.
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
enum KLed::Shape |
enum KLed::State |
Constructor & Destructor Documentation
KLed::KLed | ( | QWidget * | parent = 0 , |
|
const char * | name = 0 | |||
) |
KLed::KLed | ( | const QColor & | col, | |
KLed::State | state, | |||
KLed::Look | look, | |||
KLed::Shape | shape, | |||
QWidget * | parent = 0 , |
|||
const char * | name = 0 | |||
) |
Constructor with the ledcolor, ledstate, ledlook, the parent widget, and the name.Constructor.
Differs from above only in the parameters, which configure all settings.
Member Function Documentation
QColor KLed::color | ( | ) | const |
Returns the color of the widgetReturns LED color.
- See also:
- Color
int KLed::darkFactor | ( | ) | const |
int KLed::ensureRoundLed | ( | ) | [protected] |
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()
bool KLed::paintCachedPixmap | ( | ) | [protected] |
void KLed::paintFlat | ( | ) | [protected, virtual] |
void KLed::paintRect | ( | ) | [protected, virtual] |
void KLed::paintRectFrame | ( | bool | raised | ) | [protected, virtual] |
void KLed::paintRound | ( | ) | [protected, virtual] |
void KLed::paintSunken | ( | ) | [protected, virtual] |
void KLed::setColor | ( | const QColor & | color | ) |
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 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 in OFF state.sets the factor to darken the LED.
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 | ) |
void KLed::setShape | ( | Shape | s | ) |
void KLed::setState | ( | State | state | ) |
State KLed::state | ( | ) | const |
void KLed::toggle | ( | ) | [slot] |
void KLed::toggleState | ( | ) |
Toggle the state of the LED from Off to On and vice versa.Toggles LED on->off / off->on.
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 files: