iblqt.widgets.StatefulButton
- class iblqt.widgets.StatefulButton[source]
Bases:
ColoredButton
A QPushButton that maintains an active/inactive state.
- __init__(textActive=None, textInactive=None, active=False, parent=None, **kwargs)[source]
Initialize the StatefulButton with the specified active state.
- Parameters:
textActive (
str
, optional) – The text shown on the button when in active state.textInactive (
str
, optional) – The text shown on the button when in inactive state.active (
bool
, optional) – Initial state of the button (default is False).parent (
QWidget
) – The parent widget.**kwargs (
dict
) – Arbitrary keyword arguments (passed to ColoredButton).
- getActive()[source]
Get the active state of the button.
- Returns:
True if the button is active, False otherwise.
- Return type:
- getTextActive()[source]
Get the text shown on the button when in active state.
- Returns:
The text shown during active state.
- Return type:
- getTextInactive()[source]
Get the text shown on the button during inactive state.
- Returns:
The text shown during inactive state.
- Return type:
- 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.
- setTextActive(text)[source]
Set the text shown on the button when in active state.
- Parameters:
text (
str
) – The text to be shown during active state.
- setTextInactive(text)[source]
Set the text shown on the button during inactive state.
- Parameters:
text (
str
) – The text to be shown during inactive state.
- active: pyqtProperty
The active state of the button.
- stateChanged(bool): Signal
Emitted when the button’s state has changed. The signal carries the new state (True for active, False for inactive).
- textActive
The text shown on the button during active state.
- textInactive
The text shown on the button during inactive state.