Skip to main content

QCustomThemeDarkLightToggle

QCustomThemeDarkLightToggle

QPushButton(self, text: str, /, parent: PySide6.QtWidgets.QWidget | None = None, *, autoDefault: bool | None = None, default: bool | None = None, flat: bool | None = None) -> None

QPushButton(self, icon: PySide6.QtGui.QIcon | PySide6.QtGui.QPixmap, text: str, /, parent: PySide6.QtWidgets.QWidget | None = None, *, autoDefault: bool | None = None, default: bool | None = None, flat: bool | None = None) -> None QPushButton(self, /, parent: PySide6.QtWidgets.QWidget | None = None, *, autoDefault: bool | None = None, default: bool | None = None, flat: bool | None = None) -> None

At a glance​

TierFree (GPLv3)
Importfrom Custom_Widgets.QCustomThemeDarkLightToggle import QCustomThemeDarkLightToggle
Qt DesignerYes — drag it from the palette

Quick start​

from Custom_Widgets.QCustomThemeDarkLightToggle import QCustomThemeDarkLightToggle

widget = QCustomThemeDarkLightToggle()

Dark theme​

Colours come from the design tokens, so the widget follows the app theme with no extra work.

QCustomThemeDarkLightToggle in dark theme

Properties​

Every property below is settable in code and in Qt Designer.

PropertyTypeDefault
textstring—
iconQIcon—
iconSizeQSize—
shortcutQKeySequence—
checkablebool—
checkedbool—
autoRepeatbool—
autoExclusivebool—
autoRepeatDelayint—
autoRepeatIntervalint—
downbool—
autoDefaultbool—
defaultbool—
flatbool—
darkThemestring—
lightThemestring—
updateLabelTextbool—
updateButtonIconbool—
darkThemeIconQIcon—
lightThemeIconQIcon—

Methods​

MethodDescription
darkTheme(*args, **kwargs)Name of the CUSTOM dark theme this toggle flips to (paired with
darkThemeIcon(*args, **kwargs)Dark theme icon.
lightTheme(*args, **kwargs)Name of the CUSTOM light theme this toggle flips to.
lightThemeIcon(*args, **kwargs)Light theme icon.
setText(text: str)Set the text.
toggle_theme()Toggle theme.
updateButtonIcon(*args, **kwargs)Update the button icon.
updateLabelText(*args, **kwargs)Update the label text.
update_button_icon()Update the button icon based on the current theme.
update_button_text()Set the button text based on the current theme.

QCustomActionButton · QCustomCopyButton · QCustomQPushButton · QCustomQPushButtonGroup · QCustomRainbowButton · QCustomSocialButton · QCustomTileButton