API 參考
FluentElement
為基於 QWidget 的元件提供共用的 Fluent 設計 token 與佈景主題回呼。
沒有符合的 API 成員。
fluent::FluentElement
列舉
enum Theme解析設計 token 時使用的全域視覺佈景主題。
Light = 0Dark = 1HighContrast = 2
方法
static void setTheme(Theme theme)更新全域主題,並通知使用中的 FluentElement 執行個體。
static void setThemeDeferred(Theme theme)排程以可見元素優先的批次主題重新整理,避免阻斷目前的互動。
static Theme currentTheme()傳回目前生效的全域主題。
static bool themeUsesDarkAppearance(Theme theme)傳回主題是否使用深色底的視窗框架與材質 token。
static void refreshTheme()在設計 token 變更後重新廣播目前佈景主題以觸發重繪。
static int themeGeneration()每次主題變更時遞增的單調計數器,用於過期檢查。
Theme effectiveTheme() const解析此元素所使用的佈景主題,並遵循繼承的 QWidget 覆寫。
bool effectiveThemeUsesDarkAppearance() const傳回此元素的實際主題是否使用深色底 chrome。
bool setThemeOverrides(const QJsonObject& overrides)取代此元素的稀疏色彩、圓角與字型 token 覆寫。
QJsonObject themeOverrides() const傳回此元素的覆寫設定。
void clearThemeOverrides()將全部 token 欄位還原為全域主題預設值。
const Colors& themeColorsRef() const對目前使用中色組的不複製存取(適用於繪製熱路徑)。
Material::AcrylicToken themeAcrylic() const材質、高度層級與自適應版面配置 token。
QColor themeBackdrop(bool active) const指定啟用狀態下的視窗 chrome 背景色。
virtual void onThemeUpdated()在全域主題變更後呼叫。
型別與別名
struct Colors傳回給元件使用的設計 token 快照。
fluent::FluentElement::Colors
傳回給元件使用的設計 token 快照。
欄位
QColor strokeDefault, strokeSecondary, strokeStrongStroke Colors
QColor textOnAccent強調色背景上的文字(白/黑)。
QColor textAccentPrimary一般背景上的強調色文字。
QColor systemCritical, systemCriticalBgSystem / Semantic Colors
QColor bgLayerOverlay半透明視窗的分層內容遮罩。
fluent::FluentElement::FontStyle
欄位
QString styleName精確靜態字型,例如 "Regular" 或 "Semibold"。
int lineHeight絕對行高,Figma 實測值。
方法
fluent::FluentElement::Radius
欄位
int none直角。
int control頁面內控制項。
int overlay浮層容器(Dialog、ToolTip、Flyout)。
fluent::FluentElement::Spacing
欄位
controlHeight標準控制項高度。
fluent::FluentElement::Animation
欄位
int fast, normal, slow, verySlow持續時間(ms)