QML / Fluent conventions¶
Authoritative patterns for QWinUI3 controls and Gallery samples.
Rounded corners vs fills¶
Qt Quick clip: true only clips to an axis-aligned rectangle. It does not follow radius.
- Opaque children of a rounded
Rectangleare not masked to that radius. - Progress / selection fills must set their own
radius(usuallyhost.radius - borderWidth) and inset by the border (oftenanchors.margins: 1). - Do not rely on
clip: trueto “round” an animated bar; keep the bar inside the host bounds instead.
See Gallery Pitfalls for side-by-side demos (DelayButton / ProgressButton / ProgressBar follow the correct pattern).
Accessible / focus¶
- Attach
Accessible.*only to anItem/Action/Control. Never attach toWindow/ApplicationWindow/Popup/Menu/Dialog/Drawer/ToolTip(they are not Items). Qt already exposes popup chrome viapopupItem; name interactive children (MenuItem, buttons, labels) instead of the popup host. - Prefer
FocusStrokewithframeRadiusmatching the control corner. - Interactive Style controls expose
Accessible.role/name/ checked state / description where applicable. Do not setAccessible.value/valueMinimum/valueMaximum— those attached properties were removed in Qt 6.8; put numeric state inAccessible.description(controls with a realvalueproperty are still exposed via Qt’s value interface). - Charts / gauges use
Accessible.Graphic(or ProgressBar for meters) withtitle/ label asAccessible.name. - Composite Extras (
HeaderedTextBox,ChipGroup,StepBar,CommandBar, split/drop-down buttons) expose role + keyboard arrows / Esc / F10 where the control owns navigation. - Selection composites (
RadioButtons,SelectorBar,PagerControl,ChipGroup,ItemsView) use roving tabindex: one hostStrongFocus, childrenNoFocus, so arrows reach the group. - Title bars / caption buttons set
Accessibleon Item chrome (PlatformTitleBar,CaptionButton), not onApplicationWindow. - Pure transitions, glue (
ShellWindowSupport,WindowResizeBorder), and decorative chrome useAccessible.ignored. - QtObject singletons (
ChartUtils,ContentDialogQueue) are non-visual and omit Accessible. - Icon-only buttons must set
Accessible.name(prefertoolTipText, thentext; glyph alone is not enough). Gallery icon demos should settoolTipText. Cookbook: icons.md (1.29). - Respect
Theme.reducedMotion/Theme.highContrast(and Gallery “Follow system accessibility” / Accessibility catalog page). - High-traffic path (NavigationView, settings cards, ContentDialog, InfoBar/Toast): see
accessibility.mdfor what 1.02 fixed and what remains severity-tracked. - Keyboard:
focusPolicy: Qt.StrongFocus+activeFocusOnTabfor custom interactive Extras; handle arrows / Home / End / Esc where the control owns navigation. Date/time pickers open with Space / Enter / F4 / Alt+Down.
Extras module¶
- Inside
QWinUI3.ExtrasQML, do notimport QWinUI3.Extras(sibling types are in-module). - Prefer Theme tokens,
FluentIcons, andTheme.reducedMotion/Theme.duration().
Gallery CatalogPage¶
- See
gallery-catalog-page.md. - Root must be
Item, neverPage(Qt 6.8title/footerare FINAL). - Hosts:
ToastHost/ floating chrome →overlay; bottom bar →footer; dialogs →Overlay.overlay+ declare underoverlay.
Parent / host defaults¶
Prefer host push over parent-chain walks for layout defaults:
FormLayoutpusheslabelWidth/fieldHeaderPlacementtoformBoundfields.CommandBarpushesbarLabelPositioninto AppBar* children.SwipeControlsetsSwipeAction.swipeControl.
Placement helpers (mapToItem, Overlay.overlay) are fine; do not reintroduce
while (p = p.parent) config discovery.
Packaging¶
- Release shared libs:
python scripts/package_release_libs.py --shared - Third-party consume: packaging-consumer.md
- Default builds stay STATIC; SHARED via
-DQWINUI3_BUILD_SHARED=ON(enablesCMAKE_WINDOWS_EXPORT_ALL_SYMBOLSon MSVC). - Project license: Apache-2.0 — licensing.md, LICENSE, NOTICE.
Docs¶
- Component API docs are generated from QML header comments:
python scripts/generate_component_docs.py.