Fluent-Qt

API 参考

OverlayScrim

用于模态浮层、抽屉与聚光引导背后的同窗口压暗遮罩。

fluent::overlay::OverlayScrim

继承自 QWidget · FluentElement

构造函数

属性

double progress

模糊和压暗共用的淡入进度,从 0(透明)到 1(完全显示)。

读取 progress()设置 setProgress()
QRect spotlightRect

保持不压暗的圆角挖空(遮罩局部坐标)。

读取 spotlightRect()设置 setSpotlightRect()

方法

double progress() const

Dialog 烟雾淡入与 Gallery 引导动画使用的别名。

void setProgress(double progress)

模糊和压暗共用的淡入进度,从 0(透明)到 1(完全显示)。

void setColor(const QColor& color)

覆盖主题烟雾色;无效颜色则恢复主题 token。

QRect spotlightRect() const

保持不压暗的圆角挖空(遮罩局部坐标)。

void setSpotlightRect(const QRect& rect)

保持不压暗的圆角挖空(遮罩局部坐标)。

信号

子类扩展接口

方法

继承自 fluent::FluentElement

方法

static void setTheme(Theme theme)

更新全局主题,并通知所有活跃的 FluentElement 实例。

static void setThemeDeferred(Theme theme)

以可见元素优先的批次调度主题刷新,避免阻塞当前交互。

static Theme currentTheme()

返回当前生效的全局主题。

static bool themeUsesDarkAppearance(Theme theme)

返回指定主题是否使用暗色底的 chrome 与材质 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()

全局主题变化后调用。

枚举

enum Theme

解析设计 token 时使用的全局视觉主题。

  • Light = 0
  • Dark = 1
  • HighContrast = 2

类型与别名

struct Colors

返回给组件使用的设计 token 快照。

Qt 基类完整成员:QWidget