add_toggle#
- CommonWindowUtils.add_toggle(layout, height=40, width=None, label=None, font_size=12, bg_color=None, circle_color=None, active_color=None, text_color_on=None, text_color_off=None, show_on_off=False)[source]#
Add a label and a toggle button to a specified layout.
- Parameters:
- layout: QLayout
Layout object to add the label and toggle button to.
- height: int, optional
Height of the label and toggle. The default value is
40
.- width: list, optional
Width of the label and toggle. The default is [50, 100, 50] if
None
.- label: list of str, optional
Label text. The default value is
['label1', 'label2']
.- font_size: int, optional
Font size for the label text. The default value is
12
.- bg_color
str
,optional
Background color of the toggle switch. The default is
label_off
.- circle_color
str
,optional
Color of the circle in the toggle switch. The default is
icon_color
.- active_color
str
,optional
Color of the toggle switch when active. The default is
label_on
.- text_color_on
str
,optional
Color of the on toggle text. The default is
text_foreground
.- text_color_off
str
,optional
Color of the off toggle text. The default is
text_foreground
.- show_on_off: bool, optional
Show on and off text in the toggle. The default value is
False
.
- Returns:
tuple
A tuple containing the layout row, label object, toggle object, and second label object