NDEVR
API Documentation
LEDLightWidget

Displays a simple light widget that can be set to blink or change colors. More...

Collaboration diagram for LEDLightWidget:
[legend]

Public Member Functions

 LEDLightWidget (QWidget *parent=0)
 Constructs an LED light widget.
RGBColor currentColor () const
 Returns the current displayed color of the LED.
void disableSlot ()
 Manually turns off the LED.
void enable ()
 Manually turns on the LED.
bool lightToggledSignal (bool is_on)
 Emitted when the LED state changes.
void ping (int mSec=1000)
 Momentarily turns on the LED for a specified duration.
void setColor (QColor crOn, QColor crOff)
 Sets the LED on and off colors using QColor values.
void setColor (RGBColor crOn, RGBColor crOff=Constant< RGBColor >::Invalid)
 Sets the LED on and off colors using RGBColor values.
QSize sizeHint () const
 Returns the preferred size hint for the LED widget.
void updateBlinkSlot ()
 Slot that toggles the LED state for blink animation.

Protected Member Functions

void paintEvent (QPaintEvent *paint_event)
 Paints the LED as a filled circle with the current color.

Protected Attributes

QTimer * m_blink_timer = nullptr
 Timer used for continuous blink animation.
bool m_is_on
 Whether the LED is currently on.
RGBColor m_off_color
 The color displayed when the LED is off.
RGBColor m_on_color
 The color displayed when the LED is on.
int m_ping_cascade_count
 The number of overlapping ping requests currently active.
QTimer * m_ping_timer = nullptr
 Timer used for temporary ping illumination.

Detailed Description

Displays a simple light widget that can be set to blink or change colors.


Definition at line 12 of file LEDLightWidget.h.

Constructor & Destructor Documentation

◆ LEDLightWidget()

LEDLightWidget::LEDLightWidget ( QWidget * parent = 0)
explicit

Constructs an LED light widget.

Parameters
[in]parentThe parent widget.

Member Function Documentation

◆ currentColor()

RGBColor LEDLightWidget::currentColor ( ) const

Returns the current displayed color of the LED.

Returns
The on or off color depending on the current state.

◆ lightToggledSignal()

bool LEDLightWidget::lightToggledSignal ( bool is_on)

Emitted when the LED state changes.

Parameters
[in]is_onTrue if the LED is now on, false if off.
Returns
The signal return value.

◆ paintEvent()

void LEDLightWidget::paintEvent ( QPaintEvent * paint_event)
protected

Paints the LED as a filled circle with the current color.

Parameters
[in]paint_eventThe paint event.

◆ ping()

void LEDLightWidget::ping ( int mSec = 1000)

Momentarily turns on the LED for a specified duration.

Parameters
[in]mSecThe number of milliseconds to keep the LED on.

◆ setColor() [1/2]

void LEDLightWidget::setColor ( QColor crOn,
QColor crOff )

Sets the LED on and off colors using QColor values.

Parameters
[in]crOnThe color displayed when the LED is on.
[in]crOffThe color displayed when the LED is off.

◆ setColor() [2/2]

void LEDLightWidget::setColor ( RGBColor crOn,
RGBColor crOff = ConstantRGBColor >::Invalid )

Sets the LED on and off colors using RGBColor values.

Parameters
[in]crOnThe color displayed when the LED is on.
[in]crOffThe color displayed when the LED is off. Defaults to invalid (unchanged).

◆ sizeHint()

QSize LEDLightWidget::sizeHint ( ) const

Returns the preferred size hint for the LED widget.

Returns
The preferred size.

The documentation for this class was generated from the following file: