KLed Class Reference
An LED widget. More...
#include <kled.h>
Inheritance diagram for KLed:


Public Types | |
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 |
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.
Member Enumeration Documentation
|
Status of the light is on/off. LED on/off.
|
|
Shades of the lamp. LED shape.
|
|
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:
|
Constructor & Destructor Documentation
|
Constructs a green, round LED widget which will initially be turned on.
Definition at line 50 of file kled.cpp. References QColor::dark(), and setColor(). |
|
Constructor with the ledcolor, the parent widget, and the name. Constructor. The State will be defaulted On and the Look round.
Definition at line 67 of file kled.cpp. References QColor::dark(), and setColor(). |
|
Constructor with the ledcolor, ledstate, ledlook, the parent widget, and the name. Constructor. Differs from above only in the parameters, which configure all settings.
Definition at line 83 of file kled.cpp. References QColor::dark(), and setColor(). |
|
Destructor Destructor.
|
Member Function Documentation
|
Returns the current state of the widget (on/off). Returns LED state.
|
|
Returns the color of the widget Returns LED color.
|
|
Returns the look of the widget. Returns LED look.
|
|
Returns the factor to darken the LED. Returns dark factor.
|
|
Sets the state of the widget to On or Off. Set LED state. The widget will be painted immediately.
Definition at line 546 of file kled.cpp. References QWidget::update(). |
|
Set the shape of the LED to
Definition at line 562 of file kled.cpp. References QWidget::update(). |
|
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.
Definition at line 556 of file kled.cpp. References toggle(). |
|
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.
Definition at line 572 of file kled.cpp. References QColor::dark(), and QWidget::update(). Referenced by KLed(). |
|
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.
Definition at line 584 of file kled.cpp. References QColor::dark(), and QWidget::update(). |
|
Sets the look of the widget. Sets LED look. 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.
Definition at line 600 of file kled.cpp. References QWidget::update(). |
|
Toggles the state of the led from Off to On or vice versa. The widget repaints itself immediately. Definition at line 610 of file kled.cpp. References QWidget::update(). Referenced by toggleState(). |
|
Sets the state of the widget to On. The widget will be painted immediately.
Definition at line 618 of file kled.cpp. References setState(). |
|
Sets the state of the widget to Off. The widget will be painted immediately.
Definition at line 624 of file kled.cpp. References setState(). |
|
Paints a circular, flat LED.
Definition at line 199 of file kled.cpp. References QPainter::begin(), QWidget::colorGroup(), QPixmap::convertToImage(), QColor::dark(), QPainter::drawEllipse(), QPainter::drawPixmap(), QPainter::end(), ensureRoundLed(), QPixmap::fill(), paintCachedPixmap(), QWidget::paletteBackgroundColor(), QPainter::setBrush(), QPen::setColor(), QBrush::setColor(), QPainter::setPen(), QBrush::setStyle(), QPen::setWidth(), and QImage::smoothScale(). |
|
Paints a circular, raised LED.
Definition at line 257 of file kled.cpp. References QPainter::begin(), QWidget::colorGroup(), QPixmap::convertToImage(), QColor::dark(), QPainter::drawEllipse(), QPainter::drawPixmap(), QPainter::end(), ensureRoundLed(), QPixmap::fill(), QColor::light(), paintCachedPixmap(), QWidget::paletteBackgroundColor(), QPainter::setBrush(), QPen::setColor(), QBrush::setColor(), QPainter::setPen(), QBrush::setStyle(), QPen::setWidth(), and QImage::smoothScale(). |
|
Paints a circular, sunken LED.
Definition at line 352 of file kled.cpp. References QPainter::begin(), QWidget::colorGroup(), QPixmap::convertToImage(), QColor::dark(), QPainter::drawArc(), QPainter::drawEllipse(), QPainter::drawPixmap(), QPainter::end(), ensureRoundLed(), QPixmap::fill(), QColor::light(), paintCachedPixmap(), QWidget::paletteBackgroundColor(), QPainter::setBrush(), QPen::setColor(), QBrush::setColor(), QPainter::setPen(), QBrush::setStyle(), QPen::setWidth(), QImage::smoothScale(), and QPen::width(). |
|
Paints a rectangular, flat LED.
Definition at line 459 of file kled.cpp. References QColor::dark(), QPainter::drawLine(), QPainter::drawRect(), QWidget::height(), QPainter::setBrush(), QPainter::setPen(), and QWidget::width(). |
|
Paints a rectangular LED, either raised or sunken, depending on its argument.
Definition at line 490 of file kled.cpp. References QPainter::drawLine(), QPainter::drawRect(), QPainter::fillRect(), QWidget::height(), QPainter::setPen(), and QWidget::width(). |
|
Compute LED width.
Definition at line 163 of file kled.cpp. References QWidget::height(), and QWidget::width(). Referenced by paintFlat(), paintRound(), and paintSunken(). |
|
Paint the cached antialiased pixmap corresponding to the state if any.
Definition at line 179 of file kled.cpp. References QPainter::drawPixmap(). Referenced by paintFlat(), paintRound(), and paintSunken(). |
The documentation for this class was generated from the following files: