基礎ガイド
フォントとテキストスタイル
ラベルやカスタムウィジェットに Fluent のプリセット文字サイズとウェイトを適用します。
プリセットフォントサイズ
Typography は 12px のキャプションから 68px のディスプレイ見出しまで 9 種類のプリセットを提供します:Caption(12px)、Body(14px)、BodyStrong(14px セミボールド)、BodyLarge(18px)、BodyLargeStrong(18px セミボールド)、Subtitle(20px)、Title(28px)、TitleLarge(40px)、Display(68px)。Label に適用するには setFluentTypography() を呼び出します。
#include <FluentQt/TextFields.h>
auto* title = new fluent::textfields::Label("Account settings", this);
title->setFluentTypography(Typography::FontRole::Subtitle);import fluentqt
title = fluentqt.Label("Account settings")
title.setFluentTypography(fluentqt.FontRole.Subtitle)通常の QWidget での利用
通常の Qt ウィジェットでは、C++ の Typography::fontStyle(role).toQFont() または Python の fluentqt.font_for_role(role) で対応する QFont を取得できます。Fluent コントロールに対して直接 QWidget::setFont を呼び出すと、テーマ切り替え時にフォントが自動更新されなくなる場合があります。
#include <FluentQt/Design.h>
customWidget->setFont(Typography::fontStyle(Typography::FontRole::BodyStrong).toQFont());import fluentqt
custom_widget.setFont(fluentqt.font_for_role(fluentqt.FontRole.BodyStrong))