QtPdWidgets  2.3.1
Classes | Public Member Functions | Protected Member Functions | Static Protected Attributes | Properties | Private Slots | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Pd::MultiLed Class Reference

Multi-Color LED widget. More...

#include <MultiLed.h>

Inheritance diagram for Pd::MultiLed:
Inheritance graph
[legend]
Collaboration diagram for Pd::MultiLed:
Collaboration graph
[legend]

Classes

class  Hash
 Value hash type. More...
 
struct  Impl
 
struct  Value
 Value type. More...
 

Public Member Functions

 MultiLed (QWidget *parent=0)
 Constructor. More...
 
virtual ~MultiLed ()
 Destructor. More...
 
bool hasData () const
 
void clearData ()
 
int getValue () const
 
void setValue (int)
 Sets the current #value. More...
 
quint32 getDiameter () const
 
void setDiameter (quint32)
 Sets the LED diameter. More...
 
void resetDiameter ()
 Resets the LED diameter. More...
 
void setHash (const Hash *)
 Sets the hash. More...
 
virtual QSize sizeHint () const
 Gives a hint aboute the optimal size. More...
 

Protected Member Functions

virtual void updateColor ()
 Determines the new value of #currentColor. More...
 
void setCurrentValue (Value)
 Sets the current LED color. More...
 
bool event (QEvent *) override
 Event handler. More...
 
void paintEvent (QPaintEvent *) override
 Paint function. More...
 

Static Protected Attributes

static QColor disconnectColor = Qt::darkGray
 

Properties

quint32 diameter
 

Private Slots

void blinkEvent ()
 Blink event slot. More...
 

Private Member Functions

PD_PRIVATE void newValues (std::chrono::nanoseconds) override
 This virtual method is called by the ProcessVariable, if its value changes. More...
 

Private Attributes

struct PD_PRIVATE Impl
 
std::unique_ptr< Implimpl
 

Static Private Attributes

static QTimer blinkTimer
 Blink timer. More...
 

Detailed Description

Multi-Color LED widget.

Todo:
Default color property.

Constructor & Destructor Documentation

◆ MultiLed()

MultiLed::MultiLed ( QWidget *  parent = 0)

Constructor.

Parameters
parentParent widget.

References Impl.

◆ ~MultiLed()

MultiLed::~MultiLed ( )
virtual

Destructor.

Member Function Documentation

◆ blinkEvent

void MultiLed::blinkEvent ( )
privateslot

Blink event slot.

References Pd::MultiLed::Value::Blink, and impl.

◆ clearData()

void MultiLed::clearData ( )

References impl, and updateColor().

◆ event()

bool MultiLed::event ( QEvent *  event)
overrideprotected

Event handler.

Parameters
eventPaint event flags.

References impl.

Referenced by Pd::Led::event(), and paintEvent().

◆ getDiameter()

quint32 MultiLed::getDiameter ( ) const
Returns
The LED diameter.

References impl.

◆ getValue()

int MultiLed::getValue ( ) const
Returns
The current process #value.

References impl.

Referenced by Pd::Led::updateColor().

◆ hasData()

bool MultiLed::hasData ( ) const

References impl.

Referenced by Pd::Led::updateColor().

◆ newValues()

void MultiLed::newValues ( std::chrono::nanoseconds  )
overrideprivate

This virtual method is called by the ProcessVariable, if its value changes.

References setValue().

◆ paintEvent()

void MultiLed::paintEvent ( QPaintEvent *  event)
overrideprotected

Paint function.

Parameters
eventPaint event flags.

References event(), and impl.

◆ resetDiameter()

void MultiLed::resetDiameter ( )

Resets the LED diameter.

References DEFAULT_DIAMETER, and setDiameter().

◆ setCurrentValue()

void MultiLed::setCurrentValue ( Value  v)
protected

◆ setDiameter()

void MultiLed::setDiameter ( quint32  diameter)

Sets the LED diameter.

References diameter, and impl.

Referenced by resetDiameter().

◆ setHash()

void MultiLed::setHash ( const Hash h)

Sets the hash.

Setting a hash is mandatory to use a MultiLed.

References impl, and updateColor().

◆ setValue()

void MultiLed::setValue ( int  value)

Sets the current #value.

Looks up the LED color and redraws the widget, if necessary.

References impl, and updateColor().

Referenced by newValues().

◆ sizeHint()

QSize MultiLed::sizeHint ( ) const
virtual

Gives a hint aboute the optimal size.

References impl.

◆ updateColor()

void MultiLed::updateColor ( )
protectedvirtual

Determines the new value of #currentColor.

If a color hash is applied with setColorHash() and it contains a color for #value, #currentColor is set to that color. Otherwise it is set to Qt::magenta. If the #currentColor changed, the LED is redrawn.

Todo:
default color property

Reimplemented in Pd::Led.

References Pd::MultiLed::Value::blink, Pd::MultiLed::Value::color, disconnectColor, impl, setCurrentValue(), and Pd::MultiLed::Value::Steady.

Referenced by clearData(), setHash(), and setValue().

Member Data Documentation

◆ blinkTimer

QTimer MultiLed::blinkTimer
staticprivate

Blink timer.

Referenced by setCurrentValue().

◆ disconnectColor

QColor MultiLed::disconnectColor = Qt::darkGray
staticprotected

◆ Impl

Referenced by MultiLed().

◆ impl

std::unique_ptr<Impl> Pd::MultiLed::impl
private

Property Documentation

◆ diameter

quint32 Pd::MultiLed::diameter
readwrite

Referenced by setDiameter().


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