style_sheet¶
Module Contents¶
Style sheet manager |
|
style sheet template |
|
Style sheet base class |
|
Fluent style sheet |
|
Style sheet file |
|
Custom style sheet |
|
Custom style sheet watcher |
|
Dirty style sheet watcher |
|
Style sheet compose |
|
Theme color type |
|
apply theme color to style sheet |
|
get style sheet from qss file |
|
get style sheet |
|
set the style sheet of widget |
|
set custom style sheet |
|
add style sheet to widget |
|
update the style sheet of all fluent widgets |
|
set the theme of application |
|
toggle the theme of application |
get theme color |
|
|
set theme color |
- class StyleSheetManager¶
Bases:
PyQt5.QtCore.QObject
Style sheet manager
- register(source, widget: PyQt5.QtWidgets.QWidget, reset=True)¶
register widget to manager
Parameters¶
- source: str | StyleSheetBase
qss source, it could be: * str: qss file path * StyleSheetBase: style sheet instance
- widget: QWidget
the widget to set style sheet
- reset: bool
whether to reset the qss source
- deregister(widget: PyQt5.QtWidgets.QWidget)¶
deregister widget from manager
- items()¶
- source(widget: PyQt5.QtWidgets.QWidget)¶
get the qss source of widget
- styleSheetManager¶
- applyThemeColor(qss: str)¶
apply theme color to style sheet
Parameters¶
- qss: str
the style sheet string to apply theme color, the substituted variable should be equal to the value of ThemeColor and starts width –, i.e –ThemeColorPrimary
- class StyleSheetBase¶
Style sheet base class
- abstract path(theme=Theme.AUTO)¶
get the path of style sheet
- content(theme=Theme.AUTO)¶
get the content of style sheet
- apply(widget: PyQt5.QtWidgets.QWidget, theme=Theme.AUTO)¶
apply style sheet to widget
- class FluentStyleSheet¶
Bases:
StyleSheetBase
,enum.Enum
Fluent style sheet
- MENU = 'menu'¶
- LABEL = 'label'¶
- PIVOT = 'pivot'¶
- BUTTON = 'button'¶
- DIALOG = 'dialog'¶
- SLIDER = 'slider'¶
- INFO_BAR = 'info_bar'¶
- SPIN_BOX = 'spin_box'¶
- TAB_VIEW = 'tab_view'¶
- TOOL_TIP = 'tool_tip'¶
- CHECK_BOX = 'check_box'¶
- COMBO_BOX = 'combo_box'¶
- FLIP_VIEW = 'flip_view'¶
- LINE_EDIT = 'line_edit'¶
- LIST_VIEW = 'list_view'¶
- TREE_VIEW = 'tree_view'¶
- INFO_BADGE = 'info_badge'¶
- PIPS_PAGER = 'pips_pager'¶
- TABLE_VIEW = 'table_view'¶
- CARD_WIDGET = 'card_widget'¶
- TIME_PICKER = 'time_picker'¶
- COLOR_DIALOG = 'color_dialog'¶
- MEDIA_PLAYER = 'media_player'¶
- SETTING_CARD = 'setting_card'¶
- TEACHING_TIP = 'teaching_tip'¶
- FLUENT_WINDOW = 'fluent_window'¶
- SWITCH_BUTTON = 'switch_button'¶
- MESSAGE_DIALOG = 'message_dialog'¶
- STATE_TOOL_TIP = 'state_tool_tip'¶
- CALENDAR_PICKER = 'calendar_picker'¶
- FOLDER_LIST_DIALOG = 'folder_list_dialog'¶
- SETTING_CARD_GROUP = 'setting_card_group'¶
- EXPAND_SETTING_CARD = 'expand_setting_card'¶
- NAVIGATION_INTERFACE = 'navigation_interface'¶
- path(theme=Theme.AUTO)¶
get the path of style sheet
- class StyleSheetFile(path: str)¶
Bases:
StyleSheetBase
Style sheet file
- path(theme=Theme.AUTO)¶
get the path of style sheet
- class CustomStyleSheet(widget: PyQt5.QtWidgets.QWidget)¶
Bases:
StyleSheetBase
Custom style sheet
- DARK_QSS_KEY = 'darkCustomQss'¶
- LIGHT_QSS_KEY = 'lightCustomQss'¶
- path(theme=Theme.AUTO)¶
get the path of style sheet
- __eq__(other: object) bool ¶
Return self==value.
- setCustomStyleSheet(lightQss: str, darkQss: str)¶
set custom style sheet in light and dark theme mode
- setLightStyleSheet(qss: str)¶
set the style sheet in light mode
- setDarkStyleSheet(qss: str)¶
set the style sheet in dark mode
- lightStyleSheet() str ¶
- darkStyleSheet() str ¶
- content(theme=Theme.AUTO) str ¶
get the content of style sheet
- class CustomStyleSheetWatcher¶
Bases:
PyQt5.QtCore.QObject
Custom style sheet watcher
- eventFilter(obj: PyQt5.QtWidgets.QWidget, e: PyQt5.QtCore.QEvent)¶
- class DirtyStyleSheetWatcher¶
Bases:
PyQt5.QtCore.QObject
Dirty style sheet watcher
- eventFilter(obj: PyQt5.QtWidgets.QWidget, e: PyQt5.QtCore.QEvent)¶
- class StyleSheetCompose(sources: List[StyleSheetBase])¶
Bases:
StyleSheetBase
Style sheet compose
- content(theme=Theme.AUTO)¶
get the content of style sheet
- add(source: StyleSheetBase)¶
add style sheet source
- remove(source: StyleSheetBase)¶
remove style sheet source
- getStyleSheetFromFile(file: str | PyQt5.QtCore.QFile)¶
get style sheet from qss file
- getStyleSheet(source: str | StyleSheetBase, theme=Theme.AUTO)¶
get style sheet
Parameters¶
- source: str | StyleSheetBase
- qss source, it could be:
str: qss file path
StyleSheetBase: style sheet instance
- theme: Theme
the theme of style sheet
- setStyleSheet(widget: PyQt5.QtWidgets.QWidget, source: str | StyleSheetBase, theme=Theme.AUTO, register=True)¶
set the style sheet of widget
Parameters¶
- widget: QWidget
the widget to set style sheet
- source: str | StyleSheetBase
- qss source, it could be:
str: qss file path
StyleSheetBase: style sheet instance
- theme: Theme
the theme of style sheet
- register: bool
whether to register the widget to the style manager. If register=True, the style of the widget will be updated automatically when the theme changes
- setCustomStyleSheet(widget: PyQt5.QtWidgets.QWidget, lightQss: str, darkQss: str)¶
set custom style sheet
Parameters¶
- widget: QWidget
the widget to add style sheet
- lightQss: str
style sheet used in light theme mode
- darkQss: str
style sheet used in light theme mode
- addStyleSheet(widget: PyQt5.QtWidgets.QWidget, source: str | StyleSheetBase, theme=Theme.AUTO, register=True)¶
add style sheet to widget
Parameters¶
- widget: QWidget
the widget to set style sheet
- source: str | StyleSheetBase
- qss source, it could be:
str: qss file path
StyleSheetBase: style sheet instance
- theme: Theme
the theme of style sheet
- register: bool
whether to register the widget to the style manager. If register=True, the style of the widget will be updated automatically when the theme changes
- updateStyleSheet(lazy=False)¶
update the style sheet of all fluent widgets
Parameters¶
- lazy: bool
whether to update the style sheet lazily, set to True will accelerate theme switching
- setTheme(theme: qfluentwidgets.common.config.Theme, save=False, lazy=False)¶
set the theme of application
Parameters¶
- theme: Theme
theme mode
- save: bool
whether to save the change to config file
- lazy: bool
whether to update the style sheet lazily, set to True will accelerate theme switching
- toggleTheme(save=False, lazy=False)¶
toggle the theme of application
Parameters¶
- save: bool
whether to save the change to config file
- lazy: bool
whether to update the style sheet lazily, set to True will accelerate theme switching
- class ThemeColor¶
Bases:
enum.Enum
Theme color type
- PRIMARY = 'ThemeColorPrimary'¶
- DARK_1 = 'ThemeColorDark1'¶
- DARK_2 = 'ThemeColorDark2'¶
- DARK_3 = 'ThemeColorDark3'¶
- LIGHT_1 = 'ThemeColorLight1'¶
- LIGHT_2 = 'ThemeColorLight2'¶
- LIGHT_3 = 'ThemeColorLight3'¶
- name()¶
The name of the Enum member.
- color()¶
- themeColor()¶
get theme color