switch_button

Module Contents

Indicator

Indicator of switch button

IndicatorPosition

Indicator position

SwitchButton

Switch button class

class Indicator(parent)

Bases: qfluentwidgets.components.widgets.button.ToolButton

Indicator of switch button

checkedChanged
sliderX
mouseReleaseEvent(e)

toggle checked state when mouse release

toggle()
setDown(isDown: bool)
setHover(isHover: bool)
paintEvent(e)

paint indicator

getSliderX()
setSliderX(x)
class IndicatorPosition

Bases: enum.Enum

Indicator position

LEFT = 0
RIGHT = 1
class SwitchButton(parent: PyQt5.QtWidgets.QWidget = None, indicatorPos=IndicatorPosition.LEFT)

Bases: PyQt5.QtWidgets.QWidget

Switch button class

Constructors

  • SwitchButton(parent: QWidget = None)

  • SwitchButton(text: str = “Off”, parent: QWidget = None, `indicatorPos`=IndicatorPosition.LEFT)

checkedChanged
spacing
checked
text
onText
offText
eventFilter(obj, e: PyQt5.QtCore.QEvent)
isChecked()
setChecked(isChecked)

set checked state

toggleChecked()

toggle checked state

getText()
setText(text)
getSpacing()
setSpacing(spacing)
getOnText()
setOnText(text)
getOffText()
setOffText(text)