### Run Example Project Source: https://github.com/sumood-x/qmaterialwidgets/blob/master/docs/source/quick-start.md Navigate to an example directory and run the demo script. This assumes the package has already been installed. ```python cd examples/button python demo.py ``` -------------------------------- ### Install QMaterialWidgets Community Version Source: https://github.com/sumood-x/qmaterialwidgets/blob/master/docs/source/quick-start.md Install the community version of the library using pip. Ensure you use the specified index URL. ```shell pip install PySide6-Material-Widgets -i https://pypi.org/simple/ ``` -------------------------------- ### Installing QMaterialWidgets Plugin for Qt Designer Source: https://github.com/sumood-x/qmaterialwidgets/blob/master/docs/source/designer.md Instructions for setting up the QMaterialWidgets plugin for Qt Designer. This involves creating and activating a virtual environment, installing the package, and running a specific script to launch Qt Designer with the plugin enabled. ```shell pip install PySide6-Material-Widgets ``` ```shell python ./tools/designer.py ``` -------------------------------- ### Custom Material Icon with Theme Support Source: https://github.com/sumood-x/qmaterialwidgets/blob/master/docs/source/icon.md Inherit from MaterialIconBase and override the path() method to create custom icons that adapt to theme changes. This example defines custom icons for ADD, CUT, and COPY. ```python from enum import Enum from qmaterialwidgets import getIconColor, Theme, MaterialIconBase class MyFluentIcon(MaterialIconBase, Enum): """ Custom icons """ ADD = "Add" CUT = "Cut" COPY = "Copy" def path(self, theme=Theme.AUTO): return f':/icons/{self.value}_{getIconColor(theme)}.svg' ``` -------------------------------- ### Integrate with QtDesigner Source: https://github.com/sumood-x/qmaterialwidgets/blob/master/README.md Run the provided script to enable PySide6-Material-Widgets in QtDesigner. ```python python ./tools/designer.py ``` -------------------------------- ### Promoting a Widget in Qt Designer Source: https://github.com/sumood-x/qmaterialwidgets/blob/master/docs/source/designer.md This describes the process of promoting a standard Qt widget to a QMaterialWidgets subclass like FilledPushButton within Qt Designer. It involves using the 'Promote to...' context menu option and specifying the correct header file and class name. ```text Header file: qmaterialwidgets Class name: FilledPushButton ``` -------------------------------- ### Custom Style Sheet for Theme Changes Source: https://github.com/sumood-x/qmaterialwidgets/blob/master/docs/source/theme.md Inherit from `StyleSheetBase` and override `path()` to dynamically load different QSS files based on the current theme (light or dark). This allows the interface style to automatically adapt when the theme changes. ```python from enum import Enum from qmaterialwidgets import StyleSheetBase, Theme, isDarkTheme, qconfig class StyleSheet(StyleSheetBase, Enum): """ Style sheet """ MAIN_WINDOW = "main_window" def path(self, theme=Theme.AUTO): theme = qconfig.theme if theme == Theme.AUTO else theme return f"app/resource/qss/{theme.value.lower()}/{self.value}.qss" class MainWindow(QWidget): def __init__(self, parent=None): super().__init__(parent=parent) # apply style sheet to main window StyleSheet.MAIN_WINDOW.apply(self) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.