KLed Class Reference
Displays a round or rectangular light emitting diode. An LED widget. More...
#include <kled.h>
Inheritance diagram for KLed:

Public Types | |
enum | State |
Status of the light is on/off. LED on/off. More... | |
enum | Shape |
Shades of the lamp. LED shape. More... | |
enum | Look |
Displays a flat, round or sunken LED. LED look. More... | |
Public Slots | |
void | toggle () |
Toggles the state of the led from Off to On or vice versa. | |
void | on () |
Sets the state of the widget to On. | |
void | off () |
Sets the state of the widget to Off. | |
Public Methods | |
KLed (QWidget *parent=0, const char *name=0) | |
Constructs a green, round LED widget which will initially be turned on. | |
KLed (const QColor &col=Qt::green, QWidget *parent=0, const char *name=0) | |
Constructor with the ledcolor, the parent widget, and the name. Constructor. | |
KLed (const QColor &col, KLed::State st, 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. | |
~KLed () | |
Destructor Destructor. | |
State | state () const |
Returns the current state of the widget (on/off). Returns LED state. | |
QColor | color () const |
Returns the color of the widget Returns LED color. | |
Look | look () const |
Returns the look of the widget. Returns LED look. | |
int | darkFactor () const |
Returns the factor to darken the LED. Returns dark factor. | |
void | setState (State state) |
Sets the state of the widget to On or Off. Set LED state. | |
void | setShape (Shape s) |
Set the shape of the LED to s . | |
void | toggleState () |
Toggle the state of the LED from Off to On and vice versa. Toggles LED on->off / off->on. | |
void | setColor (const QColor &color) |
Set the color of the widget. Sets the LED color. | |
void | setDarkFactor (int darkfactor) |
Sets the factor to darken the LED in OFF state. sets the factor to darken the LED. | |
void | setLook (Look look) |
Sets the look of the widget. Sets LED look. | |
virtual QSize | sizeHint () const |
Protected Methods | |
virtual void | paintFlat () |
Paints a circular, flat LED. | |
virtual void | paintRound () |
Paints a circular, raised LED. | |
virtual void | paintSunken () |
Paints a circular, sunken LED. | |
virtual void | paintRect () |
Paints a rectangular, flat LED. | |
virtual void | paintRectFrame (bool raised) |
Paints a rectangular LED, either raised or sunken, depending on its argument. | |
void | paintEvent (QPaintEvent *) |
Detailed Description
Displays a round or rectangular light emitting diode. An LED widget.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.
- Author:
- Joerg Habenicht, Richard J. Moore (rich@kde.org) 1998, 1999
Definition at line 41 of file kled.h.
Member Enumeration Documentation
|
Status of the light is on/off. LED on/off.
Definition at line 57 of file kled.h. Referenced by KLed(). |
|
Shades of the lamp. LED shape.
Definition at line 63 of file kled.h. Referenced by KLed(), and setShape(). |
|
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 ) Definition at line 85 of file kled.h. Referenced by KLed(). |
Constructor & Destructor Documentation
|
Constructs a green, round LED widget which will initially be turned on.
Definition at line 134 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 149 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 163 of file kled.cpp. References QColor::dark(), Look, setColor(), Shape, and State. |
|
Destructor Destructor.
|
Member Function Documentation
|
Returns the current state of the widget (on/off). Returns LED state.
Definition at line 540 of file kled.cpp. Referenced by setState(). |
|
Returns the color of the widget Returns LED color.
Definition at line 552 of file kled.cpp. Referenced by paintFlat(), paintRound(), and paintSunken(). |
|
Returns the look of the widget. Returns LED look.
Definition at line 558 of file kled.cpp. Referenced by setLook(). |
|
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 564 of file kled.cpp. References state(), and QWidget::update(). |
|
Set the shape of the LED to
Definition at line 582 of file kled.cpp. References Shape, and 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 574 of file kled.cpp. References QWidget::update(). Referenced by 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 592 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 602 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 618 of file kled.cpp. References look(), and QWidget::update(). |
|
Toggles the state of the led from Off to On or vice versa. The widget repaints itself immediately. Definition at line 628 of file kled.cpp. References toggleState(). |
|
Sets the state of the widget to On. The widget will be painted immediately.
Definition at line 634 of file kled.cpp. References setState(). |
|
Sets the state of the widget to Off. The widget will be painted immediately.
Definition at line 640 of file kled.cpp. References setState(). |
|
Paints a circular, flat LED.
Definition at line 239 of file kled.cpp. References QPainter::begin(), color(), QPainter::drawEllipse(), QPainter::end(), QWidget::height(), QPainter::setBrush(), QPen::setColor(), QBrush::setColor(), QPainter::setPen(), QColor::setRgb(), QBrush::setStyle(), QPen::setWidth(), and QWidget::width(). |
|
Paints a circular, raised LED.
Definition at line 285 of file kled.cpp. References QPainter::begin(), color(), QPainter::drawEllipse(), QPainter::end(), QWidget::height(), QColor::light(), QWidget::pos(), QPainter::setBrush(), QPen::setColor(), QBrush::setColor(), QPainter::setPen(), QColor::setRgb(), QBrush::setStyle(), QPen::setWidth(), and QWidget::width(). |
|
Paints a circular, sunken LED.
Definition at line 370 of file kled.cpp. References QPainter::begin(), color(), QPainter::drawArc(), QPainter::drawEllipse(), QPainter::end(), QWidget::height(), QColor::light(), QWidget::pos(), QPainter::setBrush(), QPen::setColor(), QBrush::setColor(), QPainter::setPen(), QColor::setRgb(), QBrush::setStyle(), QPen::setWidth(), and QWidget::width(). |
|
Paints a rectangular, flat LED.
Definition at line 477 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 508 of file kled.cpp. References QPainter::drawLine(), QPainter::drawRect(), QPainter::fillRect(), QWidget::height(), QPainter::setPen(), and QWidget::width(). |
The documentation for this class was generated from the following files: