NDEVR
API Documentation
LEDLightWidget.h
1#pragma once
2#include "DLLInfo.h"
3#include <NDEVR/RGBColor.h>
4#include <QWidget>
5namespace NDEVR
6{
7 class RGBColor;
12 class NDEVR_WIDGETS_API LEDLightWidget : public QWidget
13 {
14 Q_OBJECT
15 public:
18 explicit LEDLightWidget(QWidget* parent = 0);
21 QSize sizeHint() const;
25 void setColor(QColor crOn, QColor crOff);
29 void setColor(RGBColor crOn, RGBColor crOff = Constant<RGBColor>::Invalid);
35 void ping(int mSec = 1000);
37 void enable();
38 signals:
42 bool lightToggledSignal(bool is_on);
43 public slots:
48 protected:
51 void paintEvent(QPaintEvent* paint_event);
52 protected:
53 QTimer* m_ping_timer = nullptr;
54 QTimer* m_blink_timer = nullptr;
57 bool m_is_on;
59
60 };
61
62}
void paintEvent(QPaintEvent *paint_event)
Paints the LED as a filled circle with the current color.
LEDLightWidget(QWidget *parent=0)
Constructs an LED light widget.
int m_ping_cascade_count
The number of overlapping ping requests currently active.
RGBColor currentColor() const
Returns the current displayed color of the LED.
bool lightToggledSignal(bool is_on)
Emitted when the LED state changes.
RGBColor m_on_color
The color displayed when the LED is on.
void setColor(RGBColor crOn, RGBColor crOff=Constant< RGBColor >::Invalid)
Sets the LED on and off colors using RGBColor values.
void setColor(QColor crOn, QColor crOff)
Sets the LED on and off colors using QColor values.
RGBColor m_off_color
The color displayed when the LED is off.
void enable()
Manually turns on the LED.
QTimer * m_ping_timer
Timer used for temporary ping illumination.
void disableSlot()
Manually turns off the LED.
void updateBlinkSlot()
Slot that toggles the LED state for blink animation.
bool m_is_on
Whether the LED is currently on.
QTimer * m_blink_timer
Timer used for continuous blink animation.
QSize sizeHint() const
Returns the preferred size hint for the LED widget.
void ping(int mSec=1000)
Momentarily turns on the LED for a specified duration.
Represents a color in the RGB space with optional alpha transparency.
Definition RGBColor.h:57
The primary namespace for the NDEVR SDK.