swift
Public Types | Signals | Public Member Functions | Private Member Functions | List of all members
swift::gui::CLedWidget Class Reference

Displaying an LED as widget. Non copyable. More...

Inheritance diagram for swift::gui::CLedWidget:
[legend]

Public Types

enum  LedColor {
  Red = 0 , Green , Yellow , Grey ,
  Orange , Purple , Blue , Black ,
  NoColor
}
 Colors. More...
 
enum  LedShape { Circle = 0 , Square , Triangle , Rounded }
 Shapes.
 
enum  State { On , Off , TriState }
 States.
 

Signals

void clicked ()
 LED clicked.
 

Public Member Functions

 CLedWidget (QWidget *parent=nullptr)
 Default constructor.
 
 CLedWidget (bool on, LedColor onColor, LedColor offColor, LedShape shape, const QString &onName="on", const QString &offName="off", int targetWidth=-1, QWidget *parent=nullptr)
 Constructor.
 
virtual ~CLedWidget ()
 Destructor.
 
bool value () const
 Value.
 
void setOn (bool on)
 Allows to set the led value {true, false}.
 
void blink (int resetTimeMs=500)
 Set to on for resetTimeMs.
 
void setTriState (int resetTimeMs=-1)
 Sets the 3rd state.
 
void toggleValue ()
 Toggle on / off.
 
LedShape shape () const
 Shape.
 
LedColor onColor () const
 On color.
 
LedColor offColor () const
 Off color.
 
LedColor triStateColor () const
 Tri-state color.
 
void setOnColor (LedColor color)
 Allows to change the On color {Red,Green,Yellow,Grey,Orange,Purple,blue}.
 
void setOffColor (LedColor color)
 Allows to change the Off color {Red,Green,Yellow,Grey,Orange,Purple,blue}.
 
void setTriStateColor (LedColor color)
 Temporary color until next value change.
 
void setShape (LedShape)
 Allows to change the led shape {Circle,Square,Triangle,Rounded rectangle}.
 
void setTargetWidth (int width)
 Target width.
 
QString getOnToolTip () const
 Tool tip.
 
QString getOffToolTip () const
 Tool tip.
 
QString getTriStateToolTip () const
 Tool tip.
 
void setToolTips (const QString &on, const QString &off, const QString &triState="tri-state")
 Tool tips.
 
void setOnToolTip (const QString &on)
 On tool tip.
 
void setOffToolTip (const QString &off)
 Off tool tip.
 
void setTriStateToolTip (const QString &triStateTooltip)
 Tri-state tool tip.
 
void setTriStateValues (LedColor color, const QString &tooltip)
 Tri-state.
 
void setValues (LedColor onColor, LedColor offColor, LedShape shape, const QString &toolTipOn, const QString &toolTipOff, int width=-1)
 New values dual state.
 
void setValues (LedColor onColor, LedColor offColor, LedColor triStateColor, LedShape shape, const QString &toolTipOn, const QString &toolTipOff, const QString &toolTipTriState, int width=-1)
 New values tri-state.
 
QPixmap asPixmap () const
 Render as pixmap, so it can be used with TableViews.
 

Private Member Functions

virtual void paintEvent (QPaintEvent *event)
 Paint event.
 
virtual void mousePressEvent (QMouseEvent *event)
 Mouse pressed.
 

Detailed Description

Displaying an LED as widget. Non copyable.

Remarks
Based on qLed

Definition at line 28 of file led.h.

Member Enumeration Documentation

◆ LedColor

Colors.

Remarks
NoColor has to be last entry

Definition at line 35 of file led.h.


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