How amnweb/qt-css-engine works
Qt CSS Engine is a Python library that adds time-based transitions and extra CSS-like properties to Qt widgets while leaving ordinary styling to QSS. The main workflow is: an application supplies a stylesheet, extract_rules returns cleaned QSS plus animation rules, the app installs the engine as an event filter, and widget state changes trigger property animations rendered through Qt. Documented branches include pseudo-state and dynamic-class transitions, stylesheet hot reload, static gradient translation, and non-native opacity/shadow properties. The graph follows documented capabilities where implementation excerpts are incomplete; those links are omitted when call ownership is not evidenced.
Main entry points: engine.py Transition engine · css_parser.py Rule extraction · handlers.py Property animations · QtWidgets.py Qt widgets
Components 16
Application Integration
- Qt application
- Stylesheet
- Public API
qt_css_engine/__init__.py
Stylesheet Rules
- Rule extraction
qt_css_engine/css_parser.py - Gradient translation
qt_css_engine/gradients.py - Cleaned QSS
- Animation rules
Widget Runtime
- Transition engine
qt_css_engine/engine.py - Qt widget events
- Widget states
qt_css_engine/engine.py - Widget styling
qt_css_engine/engine.py - Qt widgets
qt_css_engine/qt_compat/QtWidgets.py
Animation Support
- Property animations
qt_css_engine/handlers.py - Animation utilities
qt_css_engine/utils.py - Qt bindings
qt_css_engine/qt_compat/QtCore.py
Other components
- Application developer
Connections 19
- Application developer → Qt application: integrates
- Qt application → Public API: imports
- Qt application → Stylesheet: supplies
- Stylesheet → Rule extraction: parses
- Rule extraction → Gradient translation: translates gradients
- Rule extraction → Cleaned QSS: produces
- Rule extraction → Animation rules: produces
- Qt application → Cleaned QSS: applies
- Qt application → Transition engine: installs filter
- Qt application → Transition engine: reloads rules
- Qt widget events → Transition engine: dispatches events
- Transition engine → Animation rules: reads
- Transition engine → Widget states: evaluates
- Transition engine → Property animations: starts animations
- Property animations → Animation utilities: uses interpolation
- Property animations → Qt bindings: drives animations
- Transition engine → Widget styling: writes animated styles
- Widget styling → Qt widgets: updates
- Property animations → Qt widgets: applies effects