qtmui 0.0.47
Python Desktop Application Development
License: BSD 3-Clause License
Requires Python: >=3.9
Keywords: gui, pyqt, pyside, qt, qt components, qt flat ui, qt material ui, qt mui, qt range slider, qt widgets, qtmui

QtMui Framework
Introduction
QtMui is a powerful Python framework built on top of PySide6, designed to bring the full power of React and Material-UI (MUI) to desktop application development. Inspired by the component-based architecture and styling flexibility of MUI (https://mui.com), QtMui provides a comprehensive suite of UI components, hooks, state management, and form handling utilities. It enables developers to create modern, responsive, and cross-platform desktop applications with a declarative, React-like API. With official support at https://qtmui.com, QtMui is the go-to solution for building scalable, professional-grade desktop UIs.
Features

Comprehensive Component Library: A complete set of Material-UI-inspired components, including Box, Button, TextField, Grid, Typography, and more, designed for flexibility and ease of use.
React-Inspired Hooks: Includes hooks like useState, useEffect, useResponsive, and others to manage state, side effects, and responsive layouts in a declarative manner.
State Management with Redux: Integrated Redux support for centralized, predictable state management across complex applications.
Form Handling and Validation: Robust form management with hookform and formvalidate, enabling seamless form creation and validation.
Responsive Design: Built-in utilities like useResponsive and flexible layout components for creating adaptive UIs across different screen sizes.
Customizable Styling: Supports inline sx prop styling (MUI-like) and QSS (Qt Style Sheets) for advanced, themeable designs.
Type-Safe Development: Leverages Python’s type hints and optional static type checking for robust, maintainable codebases.
Cross-Platform: Powered by PySide6, ensuring compatibility with Windows, macOS, and Linux.
Theming Support: Create and apply custom themes to maintain consistent styling across your application.

Installation
To get started with QtMui, ensure you have Python 3.8+ installed. Install QtMui and its dependencies using pip:
```bash
pip install qtmui
```

Getting Started
Below is an example demonstrating QtMui’s component-based architecture, hooks, and Redux integration:
import sys
from qtmui.material.qtmui_app import QtMuiApp
from qtmui.material.window import QtMuiWindow
from qtmui.material.box import Box
from qtmui.material.button import Button
from qtmui.hooks import useState
from qtmui.redux import create_store, useSelector, useDispatch

# Define a simple Redux store
def counter_reducer(state=0, action=None):
    if action["type"] == "INCREMENT":
        return state + 1
    return state

store = create_store(counter_reducer)

class MainWindow(QtMuiWindow):
    def __init__(self):
        super().__init__()
        self.setCentralWidget(CounterApp())

class CounterApp:
    def __init__(self):
        self.count, self.set_count = useState(0)
        self.dispatch = useDispatch()

    def render(self):
        count = useSelector(lambda state: state)
        return Box(
            direction="column",
            spacing=10,
            sx={"padding": 20},
            children=[
                Box(sx={"font-size": 20}, children=f"Count: {count}"),
                Button(
                    children="Increment",
                    on_click=lambda: self.dispatch({"type": "INCREMENT"}),
                    sx={"background-color": "blue", "color": "white"}
                )
            ]
        )

if __name__ == "__main__":
    app = QtMuiApp(sys.argv)
    window = MainWindow()
    window.show()
    sys.exit(app.exec())

This example showcases a counter app using useState, Redux, and the Box and Button components, demonstrating QtMui’s declarative and reactive capabilities.
Key Components
QtMui offers a full suite of components inspired by Material-UI, including but not limited to:

Box: A flexible container for layout management with support for direction, spacing, and custom styling.
Button: A customizable button with variants, colors, and event handling.
TextField: An input component with form validation support.
Grid: A responsive grid system for complex layouts.
Typography: A component for styled text with customizable fonts and sizes.

Explore the full component library at https://qtmui.com/docs/components.
Hooks
QtMui provides a rich set of hooks to manage state, side effects, and responsive behavior:

useState: Manage local component state.
useEffect: Handle side effects like data fetching or DOM updates.
useResponsive: Access screen size and device information for responsive design.
useSelector/useDispatch: Integrate with Redux for global state management.

Learn more about hooks at https://qtmui.com/docs/hooks.
Form Handling
QtMui’s hookform and formvalidate utilities simplify form creation and validation:
from qtmui.material.hookform import useForm
from qtmui.material.text_field import TextField

def FormExample():
    form = useForm({"name": ""}, {"name": {"required": True, "minLength": 3}})
    return Box(
        children=[
            TextField(
                name="name",
                label="Name",
                form=form,
                sx={"width": 200}
            ),
            Button(
                children="Submit",
                on_click=form.submit,
                sx={"margin-top": 10}
            )
        ]
    )

This example demonstrates a simple form with validation, powered by hookform.
Styling and Theming
QtMui supports both inline sx styling and global QSS theming. Example of inline styling:
Box(sx={"background-color": "blue", "border-radius": 5, "padding": 10})

For global theming, define a QSS function:
from qtmui.material.styles.create_theme.theme_reducer import ThemeState

def theme_styles(_theme) -> dict:
    theme: ThemeState = _theme
    return {
        "PyBox": {
            "styles": {
                "root": {"backgroundColor": "transparent", "color": theme.palette.text.primary}
            }
        }
    }

Visit https://qtmui.com/docs/styling for detailed theming guides.
Redux Integration
QtMui seamlessly integrates with Redux for global state management. Define reducers and use hooks like useSelector and useDispatch to interact with the store, as shown in the Getting Started example.
Contributing
We welcome contributions to QtMui! To contribute:

Fork the repository at https://github.com/qtmui/qtmui.
Create a new branch for your feature or bug fix.
Submit a pull request with a clear description of your changes.

Please adhere to our coding standards and include tests where applicable. Check our contribution guidelines at https://qtmui.com/docs/contributing.
License
QtMui is licensed under the MIT License. See the LICENSE file for details.
Contact
For support, feedback, or inquiries, visit https://qtmui.com/support or file an issue at https://github.com/qtmui/qtmui/issues. Join our community discussions to connect with other developers.
Learn More
Explore the full documentation, tutorials, and API reference at https://qtmui.com to unlock the full potential of QtMui.