一键导入
qt-ui-design
Design or audit UI for Qt/QML, Qt projects, web, or embedded MPU or MCU targets. Use when creating screens, layouts, navigation, or auditing UX.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Design or audit UI for Qt/QML, Qt projects, web, or embedded MPU or MCU targets. Use when creating screens, layouts, navigation, or auditing UX.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Generates standalone Markdown reference documentation for any Qt/C++ source files — Qt Widgets classes, Qt Quick backends, Qt/C++ modules, plain C++ utilities, structs, free-function headers, and entry points like main.cpp. Use this skill to document any .h or .cpp file: Qt classes, plain C++ code, utility helpers, or application startup files. Triggers on: "document this class", "write docs for my C++", "document main.cpp", "C++ API docs", "document my Qt app", or whenever C++ or header files are provided and documentation is needed. Works with single files, pasted code, or entire project folders. DO NOT use if the user asks for QDoc format output.
Invoke when the user asks to review, check, audit, or look over Qt5 C++ code — or suggest before committing. Runs deterministic linting (60+ rules) then six parallel deep- analysis agents covering model contracts, ownership, threading, API correctness, error handling, and performance. Reports only high-confidence issues (>80/100) with structured mitigations. Read-only — never modifies code.
Extract component metadata from a Figma design system and generate production-ready QML controls. Use this skill whenever someone wants to turn Figma components into QML files — whether they say "generate components from Figma", "create QML controls based on a design system", "convert Figma components to QML", "build the component library", "extract button/input/checkbox from Figma", or anything similar. Requires design-tokens.json and QML design system singletons to already exist (from the token extraction skill). Uses Figma MCP to inspect components one at a time and maps variants, states, sizing, and token usage to idiomatic Qt Quick Controls 2 patterns. Trigger this skill at the component generation step of any QML design-system workflow.
Extract design tokens, text styles, and variables from a Figma design system and produce a design-tokens.json plus ready-to-use QML singletons. Use this skill whenever someone wants to pull their design system out of Figma — whether they say "export tokens from Figma", "get design tokens", "set up my design system", "read our Figma design system", "get Figma variables into QML", "pull our color palette from Figma", "import design tokens", "extract colors/typography/spacing from Figma", or similar. Trigger this skill at the start of any design-system workflow that involves a Figma source.
Use to generate or update Qt5 projects — both qmake (.pro) and CMake. Covers project setup, qmake .pro files, and Qt5 CMake API. When the user does not specify a build system, prefer qmake as the default for Qt5.
Generates standalone Markdown reference documentation for QML components and applications. Use this skill whenever you want to document QML files, create API reference docs for a QML component or module, document a Qt Quick application, or produce developer-facing documentation from .qml source code. Triggers on: "document this QML", "write docs for my QML", "create reference docs", "document QML component", "QML API docs", "document my Qt Quick component", "document my Qt app", or any time one or more .qml files are provided and documentation is needed. Works with single files, pasted code, or entire project folders. DO NOT use if the user asks for QDoc format output.
| name | qt-ui-design |
| description | Design or audit UI for Qt/QML, Qt projects, web, or embedded MPU or MCU targets. Use when creating screens, layouts, navigation, or auditing UX. |
| license | LicenseRef-Qt-Commercial OR BSD-3-Clause |
| compatibility | Designed for Claude Code, Codex CLI, OpenCode CLI, GitHub Copilot, and similar agents. |
| disable-model-invocation | false |
| metadata | {"author":"qt-ai-skills","version":"1.0","qt-version":"5.x","category":"conceptual","changelog":"Initial release"} |
Before producing UI output, confirm you know: target platform, screen geometry, design system, content priority, viewing distance, locale, and input methods. Run the seven items below as a check against the conversation and the project state; ask only the items that are genuinely missing. When the user cannot answer an item, choose a sensible Qt default and name it in your response so the user can correct it.
Small edits to an existing design — for example "move the OK button to the right", "change this label", "make this red" — do not trigger the checklist. Apply section 1 silently and verify section 2 (contrast, hit-target) where relevant.
Use the seven items below to decide what is already known and what to ask. If the conversation or repository has already answered an item, do not re-ask.
If the user is requesting an audit of an existing design, skip to section 5 (Audit).
Apply these while designing. Do not ask about each one — use them to inform decisions silently.
Content and layout:
Motion communicates state, relationship, and causality. Every animation must be functional, not decorative.
transform and opacity in QML/CSS — these are GPU-composited. Animating geometry (width, height, anchors) triggers layout recalculation and causes jank.prefers-reduced-motion CSS media query. Qt5 has no built-in equivalent: expose a project-level setting (for example a singleton property bound to QSettings or to a runtime accessibility option) and gate animations on it. When the user opts out, replace animation with instant transitions — do not simply slow them down.For embedded typography, see section 4.4. This subsection governs desktop and web targets only.
Use a modular scale to derive all type sizes. A modular scale is a sequence of numbers related by a fixed ratio — every size is mathematically proportional to every other, producing a scale that feels harmonious rather than arbitrary. The ratios are listed below; see also https://www.modularscale.com/ for an interactive generator.
Choose a base — the size at which your body text looks best at the target viewing distance. For desktop at ~60 cm, 16 px is a reliable starting point. The base is your ms(0).
Choose a ratio — multiply the base by this ratio to get the next step up, divide to get the next step down. Pick based on the character of the product: | Ratio | Name | Factor | Character | |---|---|---|---| | 8:9 | Major second | 1.125 | Compact, dense — good for data-heavy UIs, installer flows | | 5:6 | Minor third | 1.200 | Moderate — good for general desktop apps | | 4:5 | Major third | 1.250 | Open, comfortable — good for marketing, onboarding | | 3:4 | Perfect fourth | 1.333 | Strong contrast — good for dashboards, bold hierarchy | | 1:1.618 | Golden section | 1.618 | High contrast — use sparingly; large gaps between steps |
Map scale steps to roles — assign a step number to each typographic role. Never add roles not on the scale; if a size is needed, pick the nearest step.
| ms() | Value (px, rounded) | Role |
|---|---|---|
| ms(3) | 37.9 → 38 px | Display / hero text |
| ms(2) | 28.4 → 28 px | Page title / H1 |
| ms(1) | 21.3 → 21 px | Section heading / H2 |
| ms(0) | 16 px | Body — base |
| ms(-1) | 12.0 → 12 px | Caption / label / metadata |
Use a maximum of three to four of these steps per screen. More than four active sizes creates visual noise.
max-width on text containers — do not let prose span the full viewport.font.pointSize (which respects the platform DPI scale) over font.pixelSize for body text, or derive sizes from a singleton driven by Screen.pixelDensity. On the web, use relative units (rem).In QML, define the scale as a singleton (e.g. TypeScale.qml) so sizes are referenced by role name, not hardcoded values:
// TypeScale.qml — generated from modular scale, base 16, ratio 1.333
pragma Singleton
import QtQuick
QtObject {
readonly property real base: 16 // ms(0)
readonly property real h2: 21 // ms(1)
readonly property real h1: 28 // ms(2)
readonly property real display: 38 // ms(3)
readonly property real caption: 12 // ms(-1)
}
Reference via TypeScale.h1 in components. Recalculate the whole singleton when the base or ratio changes — never patch individual values.
Register the singleton in your QML module so it can be imported. In a qmldir file:
module MyApp.Theme
singleton TypeScale 1.0 TypeScale.qml
In CMake with qt_add_qml_module:
qt_add_qml_module(myapp_theme
URI MyApp.Theme
VERSION 1.0
QML_FILES TypeScale.qml
)
set_source_files_properties(TypeScale.qml PROPERTIES QT_QML_SINGLETON_TYPE TRUE)
Every desktop and web interface must support multiple input methods. Do not design for pointer alone.
activeFocus (for example a Rectangle border or scale bound to activeFocus) or use the style-specific focus visuals on Control. On the web, do not remove the focus ring without a styled replacement.Colour should communicate meaning consistently across the entire interface. Avoid arbitrary colour choices.
Ask question 7 in the intake. Act on the answer here.
DD/MM/YYYY. Use Qt's QLocale or the platform locale API.LayoutMirroring.enabled with LayoutMirroring.childrenInherit: true near the root of your scene; it handles anchors and Qt Quick Layouts. The following items still need explicit attention even when LayoutMirroring is enabled: Text.horizontalAlignment defaults, Image content (use mirror: true on directional icons), custom Canvas painting, and any manual x positions.Check every design against these before delivering:
When designing screens that involve AI features:
This section overrides desktop defaults. Read it fully before designing for any embedded, MCU, or hardware-constrained target.
Hardware facts that drive every decision (collect these during the intake step above if not already answered):
Software rasterisation means every visual effect costs CPU time.
| Allowed | Not allowed |
|---|---|
| Flat solid fills | Gradients |
| 1 px solid strokes | Drop shadows |
| Bitmap (PNG) icons and fonts | Blur or transparency layers |
| Opacity-only transitions | Simultaneous move + fade animations |
| Fixed pixel layout | Flexbox or fluid layout |
Prefer bitmap icons over vector paths — raster cost is paid at compile time, not runtime. Relax these constraints only when a GPU is confirmed. Exceptions. The constraints above apply to runtime software rasterisation. Qt Quick Ultralite supports compile-time-baked gradients via its static rendering pipeline. Some MCUs ship with a 2D blitter or a small GPU that relaxes the no-blur and no-transparency constraints. Verify the hardware data sheet and the Qt toolchain in use before treating the table as a hard prohibition.
Embedded fonts are bitmaps — size is fixed at build time. Get it right from the start.
| Viewing distance | Minimum size |
|---|---|
| ~50 cm (handheld, appliance) | 14 px min, 16 px preferred |
| ~1.0–1.5 m (HMI, instrument cluster) | 20 px min |
| ~2–3 m (wall panel, public display) | 28 px min |
Contrast ≥ 4.5:1 for all text. Embedded screens often have poor viewing angles and bright ambient light — higher contrast is always better.
| Rule | Desktop / web | MCU / embedded |
|---|---|---|
| Responsiveness | Flexbox, fluid | Fixed pixel layout |
| Animation | Easing curves, ≤ 400 ms | Opacity-only, < 200 ms |
| Progressive disclosure | Tooltips, hover | Explicit button only |
| Touch targets | 44 px recommended | 48 px default (relax only with explicit safety review) |
| Font rendering | Vector, OS-scalable | Bitmap, fixed at build time |
| Status communication | Color + token-based | Color + shape + text |
| Error recovery | Undo | Confirm before action |
| State visibility | Status bar / tooltip | Always on screen |
| Navigation depth | Unlimited | Max 2 levels |
| Localisation | QLocale, RTL mirroring | QLocale only (RTL rarely applicable) |
When auditing an existing design, categorize every finding:
Extended audit checklist for desktop/web targets: