TwiceAsNice
2019-02-18
|
An LED widget. More...
#include <LedWidget.h>
Classes | |
class | Private |
Public Types | |
enum | State { Off, On, Off, On, Off, On } |
Status of the light is on/off. More... | |
enum | Shape { Rectangular, Circular, Rectangular, Circular, Rectangular, Circular } |
Shades of the lamp. More... | |
enum | Look { Flat, Raised, Sunken, Flat, Raised, Sunken, Flat, Raised, Sunken } |
Displays a flat, round or sunken LED. More... | |
enum | State { Off, On, Off, On, Off, On } |
Status of the light is on/off. More... | |
enum | Shape { Rectangular, Circular, Rectangular, Circular, Rectangular, Circular } |
Shades of the lamp. More... | |
enum | Look { Flat, Raised, Sunken, Flat, Raised, Sunken, Flat, Raised, Sunken } |
Displays a flat, round or sunken LED. More... | |
enum | State { Off, On, Off, On, Off, On } |
Status of the light is on/off. More... | |
enum | Shape { Rectangular, Circular, Rectangular, Circular, Rectangular, Circular } |
Shades of the lamp. More... | |
enum | Look { Flat, Raised, Sunken, Flat, Raised, Sunken, Flat, Raised, Sunken } |
Displays a flat, round or sunken LED. More... | |
Public Slots | |
void | toggle () |
Toggles the state of the led from Off to On or vice versa. More... | |
void | on () |
Sets the state of the widget to On. More... | |
void | off () |
Sets the state of the widget to Off. More... | |
void | toggle () |
Toggles the state of the led from Off to On or vice versa. More... | |
void | on () |
Sets the state of the widget to On. More... | |
void | off () |
Sets the state of the widget to Off. More... | |
void | toggle () |
Toggles the state of the led from Off to On or vice versa. More... | |
void | on () |
Sets the state of the widget to On. More... | |
void | off () |
Sets the state of the widget to Off. More... | |
Public Member Functions | |
LedWidget (QWidget *parent=0) | |
Constructs a green, round LED widget which will initially be turned on. More... | |
LedWidget (const QColor &color, QWidget *parent=0) | |
Constructs a round LED widget with the supplied color which will initially be turned on. More... | |
LedWidget (const QColor &color, LedWidget::State state, LedWidget::Look look, LedWidget::Shape shape, QWidget *parent=0) | |
Constructor with the color, state and look. More... | |
~LedWidget () | |
Destroys the LED widget. More... | |
QColor | color () const |
Returns the current color of the widget. More... | |
State | state () const |
Returns the current state of the widget (on/off). More... | |
Look | look () const |
Returns the current look of the widget. More... | |
Shape | shape () const |
Returns the current shape of the widget. More... | |
int | darkFactor () const |
Returns the factor to darken the LED. More... | |
void | setColor (const QColor &color) |
Set the color of the widget. More... | |
void | setState (State state) |
Sets the state of the widget to On or Off. More... | |
void | setLook (Look look) |
Sets the look of the widget. More... | |
void | setShape (Shape shape) |
Set the shape of the LED. More... | |
void | setDarkFactor (int darkFactor) |
Sets the factor to darken the LED in LedWidget::Off state. More... | |
virtual QSize | sizeHint () const |
virtual QSize | minimumSizeHint () const |
LedWidget (QWidget *parent=0) | |
Constructs a green, round LED widget which will initially be turned on. More... | |
LedWidget (const QColor &color, QWidget *parent=0) | |
Constructs a round LED widget with the supplied color which will initially be turned on. More... | |
LedWidget (const QColor &color, LedWidget::State state, LedWidget::Look look, LedWidget::Shape shape, QWidget *parent=0) | |
Constructor with the color, state and look. More... | |
~LedWidget () | |
Destroys the LED widget. More... | |
QColor | color () const |
Returns the current color of the widget. More... | |
State | state () const |
Returns the current state of the widget (on/off). More... | |
Look | look () const |
Returns the current look of the widget. More... | |
Shape | shape () const |
Returns the current shape of the widget. More... | |
int | darkFactor () const |
Returns the factor to darken the LED. More... | |
void | setColor (const QColor &color) |
Set the color of the widget. More... | |
void | setState (State state) |
Sets the state of the widget to On or Off. More... | |
void | setLook (Look look) |
Sets the look of the widget. More... | |
void | setShape (Shape shape) |
Set the shape of the LED. More... | |
void | setDarkFactor (int darkFactor) |
Sets the factor to darken the LED in LedWidget::Off state. More... | |
virtual QSize | sizeHint () const |
virtual QSize | minimumSizeHint () const |
LedWidget (QWidget *parent=0) | |
Constructs a green, round LED widget which will initially be turned on. More... | |
LedWidget (const QColor &color, QWidget *parent=0) | |
Constructs a round LED widget with the supplied color which will initially be turned on. More... | |
LedWidget (const QColor &color, LedWidget::State state, LedWidget::Look look, LedWidget::Shape shape, QWidget *parent=0) | |
Constructor with the color, state and look. More... | |
~LedWidget () | |
Destroys the LED widget. More... | |
QColor | color () const |
Returns the current color of the widget. More... | |
State | state () const |
Returns the current state of the widget (on/off). More... | |
Look | look () const |
Returns the current look of the widget. More... | |
Shape | shape () const |
Returns the current shape of the widget. More... | |
int | darkFactor () const |
Returns the factor to darken the LED. More... | |
void | setColor (const QColor &color) |
Set the color of the widget. More... | |
void | setState (State state) |
Sets the state of the widget to On or Off. More... | |
void | setLook (Look look) |
Sets the look of the widget. More... | |
void | setShape (Shape shape) |
Set the shape of the LED. More... | |
void | setDarkFactor (int darkFactor) |
Sets the factor to darken the LED in LedWidget::Off state. More... | |
virtual QSize | sizeHint () const |
virtual QSize | minimumSizeHint () const |
Protected Member Functions | |
virtual int | ledWidth () const |
Returns the width of the led. More... | |
virtual void | paintFlat () |
Paints a circular, flat LED. More... | |
virtual void | paintRaised () |
Paints a circular, raised LED. More... | |
virtual void | paintSunken () |
Paints a circular, sunken LED. More... | |
virtual void | paintRect () |
Paints a rectangular, flat LED. More... | |
virtual void | paintRectFrame (bool raised) |
Paints a rectangular LED, either raised or sunken, depending on its argument. More... | |
void | paintEvent (QPaintEvent *) |
bool | paintCachedPixmap () |
Paint the cached antialiased pixmap corresponding to the state if any. More... | |
virtual int | ledWidth () const |
Returns the width of the led. More... | |
virtual void | paintFlat () |
Paints a circular, flat LED. More... | |
virtual void | paintRaised () |
Paints a circular, raised LED. More... | |
virtual void | paintSunken () |
Paints a circular, sunken LED. More... | |
virtual void | paintRect () |
Paints a rectangular, flat LED. More... | |
virtual void | paintRectFrame (bool raised) |
Paints a rectangular LED, either raised or sunken, depending on its argument. More... | |
void | paintEvent (QPaintEvent *) |
bool | paintCachedPixmap () |
Paint the cached antialiased pixmap corresponding to the state if any. More... | |
virtual int | ledWidth () const |
Returns the width of the led. More... | |
virtual void | paintFlat () |
Paints a circular, flat LED. More... | |
virtual void | paintRaised () |
Paints a circular, raised LED. More... | |
virtual void | paintSunken () |
Paints a circular, sunken LED. More... | |
virtual void | paintRect () |
Paints a rectangular, flat LED. More... | |
virtual void | paintRectFrame (bool raised) |
Paints a rectangular LED, either raised or sunken, depending on its argument. More... | |
void | paintEvent (QPaintEvent *) |
bool | paintCachedPixmap () |
Paint the cached antialiased pixmap corresponding to the state if any. More... | |
Properties | |
State | state |
Shape | shape |
Look | look |
QColor | color |
int | darkFactor |
Private Attributes | |
Private *const | d |
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.
enum LedWidget::Look |
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 )
The widget will be updated on the next repaining event.
LED look.
Enumerator | |
---|---|
Flat | |
Raised | |
Sunken | |
Flat | |
Raised | |
Sunken | |
Flat | |
Raised | |
Sunken |
enum LedWidget::Look |
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 )
The widget will be updated on the next repaining event.
LED look.
Enumerator | |
---|---|
Flat | |
Raised | |
Sunken | |
Flat | |
Raised | |
Sunken | |
Flat | |
Raised | |
Sunken |
enum LedWidget::Look |
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 )
The widget will be updated on the next repaining event.
LED look.
Enumerator | |
---|---|
Flat | |
Raised | |
Sunken | |
Flat | |
Raised | |
Sunken | |
Flat | |
Raised | |
Sunken |
enum LedWidget::Shape |
enum LedWidget::Shape |
enum LedWidget::Shape |
enum LedWidget::State |
enum LedWidget::State |
enum LedWidget::State |
|
explicit |
Constructs a green, round LED widget which will initially be turned on.
parent | The parent widget. |
|
explicit |
Constructs a round LED widget with the supplied color which will initially be turned on.
color | Initial color of the LED. |
parent | The parent widget. Constructor |
LedWidget::LedWidget | ( | const QColor & | color, |
LedWidget::State | state, | ||
LedWidget::Look | look, | ||
LedWidget::Shape | shape, | ||
QWidget * | parent = 0 |
||
) |
Constructor with the color, state and look.
Differs from above only in the parameters, which configure all settings.
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 |
LedWidget::~LedWidget | ( | ) |
Destroys the LED widget.
Destructor
|
explicit |
Constructs a green, round LED widget which will initially be turned on.
parent | The parent widget. |
|
explicit |
Constructs a round LED widget with the supplied color which will initially be turned on.
color | Initial color of the LED. |
parent | The parent widget. Constructor |
LedWidget::LedWidget | ( | const QColor & | color, |
LedWidget::State | state, | ||
LedWidget::Look | look, | ||
LedWidget::Shape | shape, | ||
QWidget * | parent = 0 |
||
) |
Constructor with the color, state and look.
Differs from above only in the parameters, which configure all settings.
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 |
LedWidget::~LedWidget | ( | ) |
Destroys the LED widget.
Destructor
|
explicit |
Constructs a green, round LED widget which will initially be turned on.
parent | The parent widget. |
|
explicit |
Constructs a round LED widget with the supplied color which will initially be turned on.
color | Initial color of the LED. |
parent | The parent widget. Constructor |
LedWidget::LedWidget | ( | const QColor & | color, |
LedWidget::State | state, | ||
LedWidget::Look | look, | ||
LedWidget::Shape | shape, | ||
QWidget * | parent = 0 |
||
) |
Constructor with the color, state and look.
Differs from above only in the parameters, which configure all settings.
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 |
LedWidget::~LedWidget | ( | ) |
Destroys the LED widget.
Destructor
QColor LedWidget::color | ( | ) | const |
Returns the current color of the widget.
QColor LedWidget::color | ( | ) | const |
Returns the current color of the widget.
QColor LedWidget::color | ( | ) | const |
Returns the current color of the widget.
int LedWidget::darkFactor | ( | ) | const |
Returns the factor to darken the LED.
int LedWidget::darkFactor | ( | ) | const |
Returns the factor to darken the LED.
int LedWidget::darkFactor | ( | ) | const |
Returns the factor to darken the LED.
|
protectedvirtual |
Returns the width of the led.
|
protectedvirtual |
Returns the width of the led.
|
protectedvirtual |
Returns the width of the led.
Look LedWidget::look | ( | ) | const |
Look LedWidget::look | ( | ) | const |
Look LedWidget::look | ( | ) | const |
|
virtual |
|
virtual |
|
virtual |
|
slot |
Sets the state of the widget to Off.
The widget will be painted immediately.
|
slot |
Sets the state of the widget to Off.
The widget will be painted immediately.
|
slot |
Sets the state of the widget to Off.
The widget will be painted immediately.
|
slot |
Sets the state of the widget to On.
The widget will be painted immediately.
|
slot |
Sets the state of the widget to On.
The widget will be painted immediately.
|
slot |
Sets the state of the widget to On.
The widget will be painted immediately.
|
protected |
Paint the cached antialiased pixmap corresponding to the state if any.
|
protected |
Paint the cached antialiased pixmap corresponding to the state if any.
|
protected |
Paint the cached antialiased pixmap corresponding to the state if any.
|
protected |
|
protected |
|
protected |
|
protectedvirtual |
Paints a circular, flat LED.
|
protectedvirtual |
Paints a circular, flat LED.
|
protectedvirtual |
Paints a circular, flat LED.
|
protectedvirtual |
Paints a circular, raised LED.
|
protectedvirtual |
Paints a circular, raised LED.
|
protectedvirtual |
Paints a circular, raised LED.
|
protectedvirtual |
Paints a rectangular, flat LED.
|
protectedvirtual |
Paints a rectangular, flat LED.
|
protectedvirtual |
Paints a rectangular, flat LED.
|
protectedvirtual |
Paints a rectangular LED, either raised or sunken, depending on its argument.
|
protectedvirtual |
Paints a rectangular LED, either raised or sunken, depending on its argument.
|
protectedvirtual |
Paints a rectangular LED, either raised or sunken, depending on its argument.
|
protectedvirtual |
Paints a circular, sunken LED.
|
protectedvirtual |
Paints a circular, sunken LED.
|
protectedvirtual |
Paints a circular, sunken LED.
void LedWidget::setColor | ( | const QColor & | color | ) |
Set the color of the widget.
The LED is shown with Color when in the LedWidget::On state or with the darken Color (
The widget calls the update() method, so it will be updated when entering the main event loop.
color | New color of the LED. Sets the LED color. |
void LedWidget::setColor | ( | const QColor & | color | ) |
Set the color of the widget.
The LED is shown with Color when in the LedWidget::On state or with the darken Color (
The widget calls the update() method, so it will be updated when entering the main event loop.
color | New color of the LED. Sets the LED color. |
void LedWidget::setColor | ( | const QColor & | color | ) |
Set the color of the widget.
The LED is shown with Color when in the LedWidget::On state or with the darken Color (
The widget calls the update() method, so it will be updated when entering the main event loop.
color | New color of the LED. Sets the LED color. |
void LedWidget::setDarkFactor | ( | int | darkFactor | ) |
Sets the factor to darken the LED in LedWidget::Off state.
The
darkFactor | should be greater than 100, otherwise the LED becomes lighter in LedWidget::Off state. |
Defaults to 300.
darkFactor | Sets the factor to darken the LED. Sets the factor to darken the LED. |
void LedWidget::setDarkFactor | ( | int | darkFactor | ) |
Sets the factor to darken the LED in LedWidget::Off state.
The
darkFactor | should be greater than 100, otherwise the LED becomes lighter in LedWidget::Off state. |
Defaults to 300.
darkFactor | Sets the factor to darken the LED. Sets the factor to darken the LED. |
void LedWidget::setDarkFactor | ( | int | darkFactor | ) |
Sets the factor to darken the LED in LedWidget::Off state.
The
darkFactor | should be greater than 100, otherwise the LED becomes lighter in LedWidget::Off state. |
Defaults to 300.
darkFactor | Sets the factor to darken the LED. Sets the factor to darken the LED. |
void LedWidget::setLook | ( | Look | look | ) |
void LedWidget::setLook | ( | Look | look | ) |
void LedWidget::setLook | ( | Look | look | ) |
void LedWidget::setShape | ( | Shape | shape | ) |
Set the shape of the LED.
shape | The LED shape. Set LED shape. |
void LedWidget::setShape | ( | Shape | shape | ) |
Set the shape of the LED.
shape | The LED shape. Set LED shape. |
void LedWidget::setShape | ( | Shape | shape | ) |
Set the shape of the LED.
shape | The LED shape. Set LED shape. |
void LedWidget::setState | ( | State | state | ) |
void LedWidget::setState | ( | State | state | ) |
void LedWidget::setState | ( | State | state | ) |
Shape LedWidget::shape | ( | ) | const |
Shape LedWidget::shape | ( | ) | const |
Shape LedWidget::shape | ( | ) | const |
|
virtual |
|
virtual |
|
virtual |
State LedWidget::state | ( | ) | const |
State LedWidget::state | ( | ) | const |
State LedWidget::state | ( | ) | const |
|
slot |
Toggles the state of the led from Off to On or vice versa.
The widget repaints itself immediately.
|
slot |
Toggles the state of the led from Off to On or vice versa.
The widget repaints itself immediately.
|
slot |
Toggles the state of the led from Off to On or vice versa.
The widget repaints itself immediately.
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |
|
readwrite |