QLedWidget#
- class QInstrument.widgets.QLedWidget.QLedWidget(*args, color=None, state=None, blink=None, interval=None, **kwargs)[source]#
Bases:
QWidgetLED indicator widget drawn with QPainter.
Renders a colored LED that can be on, off, or blinking.
Properties#
- blinkbool
True: LED alternates between ON and OFF states at
intervalms per state. False: LED returns to its saved state and stops blinking.- colorQLedWidget.Color
LED color. One of
RED,AMBER,GREEN,BLUE,VIOLET,WHITE.- intervalint [ms]
Duration of each ON/OFF phase during blinking. Default: 400.
- stateQLedWidget.State
ON: LED is bright.OFF: LED is dark.
- class Color(*values)[source]#
Bases:
Enum- RED = 1#
- AMBER = 2#
- GREEN = 3#
- BLUE = 4#
- VIOLET = 5#
- WHITE = 6#
- RED = 1#
- AMBER = 2#
- GREEN = 3#
- BLUE = 4#
- VIOLET = 5#
- WHITE = 6#
- OFF = 0#
- ON = 1#
- hexcodes = {Color.AMBER: {State.OFF: ('aa4400', 'ad892c'), State.ON: ('d45500', 'ffd42a')}, Color.BLUE: {State.OFF: ('102151', '0a163c'), State.ON: ('082686', '0342eb')}, Color.GREEN: {State.OFF: ('001c00', '008200'), State.ON: ('009400', '00d700')}, Color.RED: {State.OFF: ('3f0000', 'a00000'), State.ON: ('af0000', 'ff0f0f')}, Color.VIOLET: {State.OFF: ('45098f', '471b7d'), State.ON: ('5a00cc', 'a65fff')}, Color.WHITE: {State.OFF: ('505055', 'a0a0aa'), State.ON: ('d0d0dd', 'f0f0ff')}}#
- changeEvent(event)[source]#
Gray out the LED when disabled; restore color when re-enabled.
When the widget (or any ancestor) is disabled, the LED switches to WHITE/OFF so it looks unpowered, consistent with the rest of the disabled instrument UI. The original color, state, and blink are saved and restored when the widget is re-enabled.
- Return type: