# eric5.E5Gui.E5Led

Module implementing a LED widget.

It was inspired by KLed.

### Global Attributes

E5LedCircular
E5LedRectangular

### Classes

E5ClickableLed | Class implementing a clickable LED widget.
E5Led | Class implementing a LED widget.

### Functions

None

## E5ClickableLed

Class implementing a clickable LED widget.

### Signals

clicked(QPoint)
  emitted upon a click on the LED with the left button
middleClicked(QPoint)
  emitted upon a click on the LED with the middle button or CTRL and left button

### Derived from

E5Led

### Class Attributes

None

### Class Methods

None

### Methods

E5ClickableLed | Constructor
mouseReleaseEvent | Protected method handling mouse release events.

### Static Methods

None

#### E5ClickableLed (Constructor)

E5ClickableLed(parent=None, color=None, shape=E5LedCircular, rectRatio=1)

Constructor

parent
  reference to parent widget (QWidget)
color
  color of the LED (QColor)
shape
  shape of the LED (E5LedCircular, E5LedRectangular)
rectRatio
  ratio width to height, if shape is rectangular (float)

#### E5ClickableLed.mouseReleaseEvent

mouseReleaseEvent(evt)

Protected method handling mouse release events.

evt
  mouse event (QMouseEvent)

Up

## E5Led

Class implementing a LED widget.

### Derived from

QWidget

### Class Attributes

None

### Class Methods

None

### Methods

E5Led | Constructor
__getBestRoundSize | Private method to calculate the width of the LED.
__paintRectangular | Private method to paint a rectangular raised LED.
__paintRound | Private method to paint a round raised LED.
color | Public method to return the LED color.
darkFactor | Public method to return the dark factor.
isFramed | Public method to return the framed state.
isOn | Public method to return the LED state.
minimumSizeHint | Public method to give a hint about our minimum size.
off | Public slot to set the LED to off.
on | Public slot to set the LED to on.
paintEvent | Protected slot handling the paint event.
ratio | Public method to return the LED rectangular ratio [= width / height].
setColor | Public method to set the LED color.
setDarkFactor | Public method to set the dark factor.
setFramed | Public slot to set the __framedLed attribute.
setOn | Public method to set the LED to on.
setRatio | Public method to set the LED rectangular ratio (width / height).
setShape | Public method to set the LED shape.
shape | Public method to return the LED shape.
sizeHint | Public method to give a hint about our desired size.
toggle | Public slot to toggle the LED state.

### Static Methods

None

#### E5Led (Constructor)

E5Led(parent=None, color=None, shape=E5LedCircular, rectRatio=1)

Constructor

parent
  reference to parent widget (QWidget)
color
  color of the LED (QColor)
shape
  shape of the LED (E5LedCircular, E5LedRectangular)
rectRatio
  ratio width to height, if shape is rectangular (float)

#### E5Led.__getBestRoundSize

__getBestRoundSize()

Private method to calculate the width of the LED.

Returns:
  new width of the LED (integer)

#### E5Led.__paintRectangular

__paintRectangular()

Private method to paint a rectangular raised LED.

#### E5Led.__paintRound

__paintRound()

Private method to paint a round raised LED.

#### E5Led.color

color()

Public method to return the LED color.

Returns:
  color of the LED (QColor)

#### E5Led.darkFactor

darkFactor()

Public method to return the dark factor.

Returns:
  the current dark factor (integer)

#### E5Led.isFramed

isFramed()

Public method to return the framed state.

Returns:
  flag indicating the current framed state (boolean)

#### E5Led.isOn

isOn()

Public method to return the LED state.

Returns:
  flag indicating the light state (boolean)

#### E5Led.minimumSizeHint

minimumSizeHint()

Public method to give a hint about our minimum size.

Returns:
  size hint (QSize)

#### E5Led.off

off()

Public slot to set the LED to off.

#### E5Led.on

on()

Public slot to set the LED to on.

#### E5Led.paintEvent

paintEvent(evt)

Protected slot handling the paint event.

evt
  paint event object (QPaintEvent)

Raises TypeError:
  The E5Led has an unsupported shape type.

#### E5Led.ratio

ratio()

Public method to return the LED rectangular ratio [= width / height].

Returns:
  LED rectangular ratio (float)

#### E5Led.setColor

setColor(color)

Public method to set the LED color.

color
  color for the LED (QColor)

#### E5Led.setDarkFactor

setDarkFactor(darkfactor)

Public method to set the dark factor.

darkfactor
  value to set for the dark factor (integer)

#### E5Led.setFramed

setFramed(framed)

Public slot to set the __framedLed attribute.

framed
  flag indicating the framed state (boolean)

#### E5Led.setOn

setOn(state)

Public method to set the LED to on.

state
  new state of the LED (boolean)

#### E5Led.setRatio

setRatio(ratio)

Public method to set the LED rectangular ratio (width / height).

ratio
  new LED rectangular ratio (float)

#### E5Led.setShape

setShape(shape)

Public method to set the LED shape.

shape
  new LED shape (E5LedCircular, E5LedRectangular)

#### E5Led.shape

shape()

Public method to return the LED shape.

Returns:
  LED shape (E5LedCircular, E5LedRectangular)

#### E5Led.sizeHint

sizeHint()

Public method to give a hint about our desired size.

Returns:
  size hint (QSize)

#### E5Led.toggle

toggle()

Public slot to toggle the LED state.

Up