# Architecture overview
`qt-material3-widget` is organized as a layered Qt Widgets framework.
The core rule is:
> Widgets render from resolved specs, not from ad hoc theme lookups.
## Core architecture
```mermaid
flowchart TB
app["Applications / Consumers
Use QtMaterial3::Theme and QtMaterial3::Widgets"]
inputs["Theme Inputs
Seed color
ThemeOptions
JSON import / export"]
m3["Material 3 Guidance
Color roles
Typography
Shape
Motion"]
legacy["qtmaterial3_legacy
Temporary migration bridge
Legacy alias map
Legacy theme bridge"]
theme["qtmaterial3_theme
Tokens, schemes, builder, manager
ColorScheme · TypographyScale · ShapeScale
Shape · ElevationScale · MotionTokens
ThemeBuilder · ThemeManager"]
rule["Core rule:
Widgets render from resolved specs,
not from ad hoc theme lookups."]
core["qtmaterial3_core
Widget bases and interaction state
Widget / Surface bases
AbstractButton
SelectionControl
InputControl
InteractionState"]
specs["qtmaterial3_specs
Immutable component specs + factory
SpecFactory
Button / Dialog / TextField
Card / NavigationDrawer
Banner / AppBar / List / DateField"]
effects["qtmaterial3_effects
Visual effects and motion
Ripple · State layer painter · Focus indicator
Shadow · Transition controller · Scrim"]
widgets["qtmaterial3_widgets
Public widget implementations
Buttons · Selection · Inputs · Surfaces · Data
TextButton, FilledButton, FAB, Checkbox, Switch, RadioButton,
Dialog, NavigationDrawer, BottomSheet, Banner, Card,
AppBars, TextFields, List, Divider"]
qt["Qt Platform
Qt Core · Qt Gui · Qt Widgets"]
inputs --> theme
m3 --> theme
legacy --> theme
theme --> app
widgets --> app
theme --> rule
rule --> core
rule --> specs
rule --> effects
theme --> core
theme --> specs
theme --> effects
theme --> widgets
core --> specs
core --> effects
core --> widgets
specs -->|"resolved specs"| widgets
effects --> widgets
qt -. supports .-> theme
qt -. supports .-> core
qt -. supports .-> specs
qt -. supports .-> effects
qt -. supports .-> widgets
classDef consumer fill:#eef5ff,stroke:#2563eb,stroke-width:1.5px,color:#0f172a;
classDef theme fill:#eff6ff,stroke:#1d4ed8,stroke-width:1.5px,color:#0f172a;
classDef core fill:#ecfdf5,stroke:#059669,stroke-width:1.5px,color:#0f172a;
classDef specs fill:#f5f3ff,stroke:#7c3aed,stroke-width:1.5px,color:#0f172a;
classDef effects fill:#faf5ff,stroke:#9333ea,stroke-width:1.5px,color:#0f172a;
classDef widgets fill:#f3e8ff,stroke:#6d28d9,stroke-width:1.8px,color:#0f172a;
classDef support fill:#f8fafc,stroke:#64748b,stroke-width:1px,color:#0f172a;
classDef note fill:#fff7ed,stroke:#f59e0b,stroke-width:1.5px,color:#431407;
class app consumer;
class inputs,m3,legacy,qt support;
class theme theme;
class core core;
class specs specs;
class effects effects;
class widgets widgets;
class rule note;
```
## Theme-to-widget flow
```mermaid
sequenceDiagram
participant App as Application
participant Manager as ThemeManager
participant Theme as Theme
participant Factory as SpecFactory
participant Spec as Component Spec
participant Widget as Material Widget
participant Effects as Effects
App->>Manager: setTheme(...) / applyTheme(...)
Manager->>Theme: resolve color, typography, shape, elevation, motion tokens
Widget->>Factory: request component spec
Factory->>Theme: read resolved tokens
Factory-->>Spec: build immutable spec
Spec-->>Widget: resolved rendering contract
Widget->>Effects: configure ripple, state layer, focus, shadow, transition
Widget-->>App: render Qt Widget
```