Toggle Switch¶
An iOS-style toggle switch widget for boolean input.
Preview
FXToggleSwitch
¶
Bases: ,
A modern iOS/Material-style animated toggle switch.
This widget provides a sleek alternative to QCheckBox with smooth sliding animation and theme-aware colors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
|
Parent widget. |
None
|
|
|
Color when switch is on. If None, uses theme accent. |
None
|
|
|
Color when switch is off. If None, uses theme surface. |
None
|
|
|
Color of the thumb/knob. If None, uses white. |
None
|
Signals
toggled: Emitted when the switch state changes.
Examples:
>>> switch = FXToggleSwitch()
>>> switch.toggled.connect(lambda checked: print(f"Switch: {checked}"))
>>> switch.setChecked(True)
Methods:
| Name | Description |
|---|---|
|
Return True if pos is inside the clickable area. |
|
Return the minimum size of the switch. |
|
Paint the toggle switch. |
|
Set the animation position and trigger repaint. |
|
Return the preferred size of the switch. |