レイアウト
PropertyPanel プロパティパネル
明示的な定義から、グループ化・検索・リセット・検証を備えた Fluent プロパティエディターを生成します。
サンプル
プロパティプレビューを読み込めませんでした。もう一度「プロパティプレビュー」を選択して再試行してください。

使い方
ドキュメントタイトルの編集
タイトルを変更するとプレビューが更新されます。クリアすると無題のドキュメントとして表示され、フィールドをリセットすることもできます。
#include <FluentQt/Layout.h>
using namespace fluent::layout;
auto* document = new Card(this);
document->setMaximumWidth(480);
document->setBorderVisible(false);
auto* body = new QVBoxLayout(document);
body->setContentsMargins(16, 16, 16, 16);
body->setSpacing(12);
auto* identity = new QHBoxLayout;
identity->setSpacing(8);
auto* icon = new FontIcon(Typography::Icons::Document, document);
icon->setIconSize(20);
identity->addWidget(icon);
auto* preview = new Label("Quarterly report", document);
preview->setFluentTypography(Typography::FontRole::Body);
preview->setTextColorRole(Label::TextColorRole::Primary);
preview->setTextFormat(Qt::PlainText);
preview->setTextElideMode(Qt::ElideRight);
preview->setMinimumWidth(0);
preview->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Preferred);
identity->addWidget(preview, 1);
auto* panel = new fluent::layout::PropertyPanel(document);
panel->setLayoutMode(fluent::layout::PropertyPanel::LayoutMode::Stacked);
fluent::layout::PropertyDefinition title;
title.key = "title";
title.label = "Title";
title.defaultValue = QStringLiteral("Quarterly report");
panel->setProperties({title});
panel->setFixedHeight(64);
body->addWidget(panel);
body->addLayout(identity);
connect(panel, &fluent::layout::PropertyPanel::valueEdited, preview,
[preview](const QString&, const QVariant& value) {
const QString title = value.toString().trimmed();
preview->setText(title.isEmpty() ? QStringLiteral("Untitled document") : title);
});import fluentqt
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QHBoxLayout, QSizePolicy, QVBoxLayout
document = fluentqt.Card()
document.setObjectName("propertyDocumentSample")
document.setMaximumWidth(480)
document.setBorderVisible(False)
body = QVBoxLayout(document)
body.setContentsMargins(16, 16, 16, 16)
body.setSpacing(12)
identity = QHBoxLayout()
identity.setSpacing(8)
icon = fluentqt.FontIcon(fluentqt.Typography.Icons.Document, document)
icon.setIconSize(20)
identity.addWidget(icon)
preview = fluentqt.Label("Quarterly report", document)
preview.setObjectName("propertyDocumentTitle")
preview.setFluentTypography(fluentqt.FontRole.Body)
preview.setTextColorRole(fluentqt.Label.TextColorRole.Primary)
preview.setTextFormat(Qt.PlainText)
preview.setTextElideMode(Qt.ElideRight)
preview.setMinimumWidth(0)
preview.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred)
identity.addWidget(preview, 1)
panel = fluentqt.PropertyPanel(document)
panel.setObjectName("documentProperties")
panel.setLayoutMode(fluentqt.PropertyPanel.LayoutMode.Stacked)
title = fluentqt.PropertyDefinition()
title.key = "title"
title.label = "Title"
title.defaultValue = "Quarterly report"
panel.setProperties([title])
panel.setFixedHeight(64)
body.addWidget(panel)
body.addLayout(identity)
def update_title(key, value):
preview.setText(value.strip() or "Untitled document")
panel.valueEdited.connect(update_title)API
宣言を表示一致する API メンバーはありません。
fluent::layout::PropertyPanel
継承元 QWidget · FluentElement · QMLPlus
最大 128 個の PropertyDefinition 項目から生成されるグループ化されたプロパティフォームで、検索とリセットに対応しています。ユーザー操作による編集時のみ valueEdited() を送出し、プログラムからの setValue() 更新では送出されません。
コンストラクタ
デストラクタ
列挙型
enum class LayoutMode自動レイアウトでは、スペースに余裕がある場合にラベルをエディターの横に配置します。
AutomaticStackedInline
enum class SearchVisibility自動検索は、フィールドが 8 個以上ある場合、または検索クエリが空でない場合に表示されます。
AutomaticVisibleHidden
メソッド
bool setProperties(const QVector<PropertyDefinition>& properties)定義をアトミックに置き換えます。無効なキーや重複したキーがある場合はパネルを変更しません。
bool setValue(const QString& key, const QVariant& value)宣言された型を使用して既知のエディターを更新します。無効な値は拒否され、変更が追跡されます。
bool resetProperty(const QString& key)宣言されたデフォルト値を適用し、編集可能な値が実際に変化した場合のみ valueEdited を送出します。
void resetAll()フィルタされたフィールドを含め、デフォルト値を持つ編集可能プロパティをリセットします。
QWidget* editor(const QString& key) constkey 用に生成されたエディターを返します(パネルが所有し、setProperties() の呼び出し後は無効になります)。
プロパティ
QString searchText- 読み取り
searchText()書き込みsetSearchText()通知シグナルsearchTextChanged() bool readOnly- 読み取り
isReadOnly()書き込みsetReadOnly()通知シグナルreadOnlyChanged() LayoutMode layoutMode- 読み取り
layoutMode()書き込みsetLayoutMode()通知シグナルlayoutModeChanged() SearchVisibility searchVisibility- 読み取り
searchVisibility()書き込みsetSearchVisibility()通知シグナルsearchVisibilityChanged() QStringList modifiedPropertyKeys- 読み取り
modifiedPropertyKeys()通知シグナルmodifiedPropertiesChanged()
シグナル
protected メンバー
メソッド
fluent::FluentElement から継承
列挙型
enum Themeデザイントークン解決時に使用されるグローバルな視覚テーマ。
Light = 0Dark = 1HighContrast = 2
メソッド
static void setTheme(Theme theme)グローバルテーマを更新し、アクティブな FluentElement インスタンスに通知します。
static void setThemeDeferred(Theme theme)現在の操作をブロックせずに、可視要素を優先したバッチ処理でテーマの更新をスケジュールします。
static Theme currentTheme()現在有効なグローバルテーマを返します。
static bool themeUsesDarkAppearance(Theme theme)テーマがダークベースのクロームおよびマテリアルトークンを使用するかどうかを返します。
static void refreshTheme()デザイントークンの変更後に再描画するため、現在のテーマを再ブロードキャストします。
static int themeGeneration()テーマ変更ごとに加算される単調増加カウンターです。鮮度チェックに使用されます。
Theme effectiveTheme() const継承された QWidget の上書きを尊重し、この要素が使用するテーマを解決します。
bool effectiveThemeUsesDarkAppearance() constこの要素の有効なテーマがダークベースのクロームを使用するかどうかを返します。
bool setThemeOverrides(const QJsonObject& overrides)この要素のスパースな色、角丸半径、フォントトークンの上書きを置き換えます。
QJsonObject themeOverrides() constこの要素に設定されたオーバーライドを返します。
void clearThemeOverrides()すべてのトークンフィールドをグローバルテーマの既定値に復元します。
const Colors& themeColorsRef() const描画のホットパス向けにアクティブなカラーセットへ非コピーでアクセスします。
Material::AcrylicToken themeAcrylic() constマテリアル、エレベーション、およびアダプティブレイアウトのトークン。
QColor themeBackdrop(bool active) const指定されたアクティブ状態に対するウィンドウ chrome の背景色。
virtual void onThemeUpdated()グローバルテーマの変更後に呼び出されます。
型とエイリアス
struct Colorsコンポーネントに返されるデザイントークンのスナップショット。
fluent::QMLPlus から継承
メソッド
AnchorLayout::Anchors* anchors()QWidget ホストの変更可能なアンカーを返します。
void setState(const QString& name)登録済みの状態を名前で適用するか、@p name が空の場合はデフォルト状態を復元します。未知の名前は無視され、その状態を離れると既存のバインディングが再開されます。
void addState(const QMLState& state)名前付き状態定義を登録または置換します。アクティブな状態を置換した場合は即座に適用されます。
void evaluateStates()登録順に状態条件を再評価し、最初に一致した状態(一致しない場合はデフォルト状態)をアクティブにします。依存プロパティの変更通知時にも自動実行され、extend を使用する派生状態は、循環や欠損がない限り祖先の変更を継承します。
QMLPlusRuntime* runtime()このホストが所有し、遅延生成される状態オブザーバーを返します。
void setAnchors(const AnchorLayout::Anchors& anchors)すべてのホストアンカーを置き換え、親レイアウトを無効化します。
void resetAnchors()ホストのすべてのアンカーをクリアし、親レイアウトを無効化します。
void bind(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction dir = PropertyBinder::OneWay)PropertyBinder::bind() を介して、@p source の @p sourceProp をこの QWidget ホストの @p targetProp にバインドします。
BindingHandle bindManaged(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction direction = PropertyBinder::OneWay, BindingOptions options = {})この QWidget ホストに管理された直接バインディングを設定します。
BindingHandle bindComputed(const char* targetProp, const QVector<BindingDependency>& dependencies, std::function<QVariant()> evaluate, BindingOptions options = {})この QWidget ホストに明示的依存関係を持つ C++ 式を設定します。
void addTransition(const StateTransition& transition)優先順位順に状態遷移を登録します。
void setBehavior(const char* propertyName, const PropertyAnimation& animation)writeProperty() またはバインディング経由で @p propertyName が書き込まれた際に使用されるデフォルトアニメーションを設定します。明示的な StateTransition ルールが優先され、C++ のセッターを直接呼び出した場合はアニメーションしません。
void clearBehavior(const char* propertyName)今後のマネージド書き込みに使用するデフォルトアニメーションを削除します。
bool writeProperty(const char* propertyName, const QVariant& value)バインディングを削除せずに Behavior 経由でホストプロパティに書き込みます。
Qt 基底クラスドキュメント:QWidget
fluent::layout::PropertyDefinition
PropertyPanel が生成する 1 つのプロパティ行を記述するスキーマです。Choice は choices の文字列を使用し、Number は minimum/maximum/step で制限され、有効な defaultValue があるとリセットが有効になります。
列挙型
enum TypeTextNumberBooleanChoiceColor