iblqt.widgets.StatefulButton

class iblqt.widgets.StatefulButton[source]

Bases: QPushButton

A QPushButton that maintains an active/inactive state.

__init__(*args, active=False, **kwargs)[source]

Initialize the StatefulButton with the specified active state.

Parameters:
  • *args (tuple) – Positional arguments passed to QPushButton constructor.

  • active (bool, optional) – Initial state of the button (default is False).

  • **kwargs (dict) – Keyword arguments passed to QPushButton constructor.

getActive()[source]

Get the active state of the button.

Returns:

True if the button is active, False otherwise.

Return type:

bool

setActive(value)[source]

Set the active state of the button.

Emits stateChanged if the state has changed.

Parameters:

value (bool) – The new active state of the button.

active: pyqtProperty

The active state of the button.

clickedWhileActive: Signal

Emitted when the button is clicked while it is in the active state.

clickedWhileInactive: Signal

Emitted when the button is clicked while it is in the inactive state.

stateChanged(bool): Signal

Emitted when the button’s state has changed. The signal carries the new state (True for active, False for inactive).