Fluent-Qt

レイアウト

ListDetailView リスト詳細ビュー

一覧と詳細を並べて表示し、幅が狭いときは1ペインずつ切り替えて表示します。レイアウトが切り替わっても同じコンテンツウィジェットが維持されます。

サンプル

ListDetailView リスト詳細ビュー: 1ペインまたは2ペイン

使い方

1ペインまたは2ペイン

Narrow プレビューを選択し、会議メモを開いてテキストを編集します。一覧に戻るか Wide プレビューに切り替えても、同じメモに変更内容が保持されます。

#include <FluentQt/Layout.h>
using namespace fluent::layout;

auto* panel = new QWidget(this);
auto* body = new QVBoxLayout(panel);
body->setContentsMargins(0, 0, 0, 0);
body->setSpacing(12);
auto* width = new ComboBox(panel);
width->setAccessibleName("Preview width");
width->addItems({"Wide preview", "Narrow preview"});
body->addWidget(width, 0, Qt::AlignLeft);
auto* view = new fluent::layout::ListDetailView(panel);
view->setCompactThreshold(520);
view->setMaximumWidth(640);
view->setFixedHeight(156);
body->addWidget(view, 0, Qt::AlignLeft);
auto* list = new QVBoxLayout(view->listPane());
list->addWidget(new Label("Notes", view->listPane()));
auto* open = new Button("Open meeting note", view->listPane());
list->addWidget(open);
list->addStretch();
auto* detail = new QVBoxLayout(view->detailPane());
auto* back = new Button("Back to notes", view->detailPane());
back->setFluentStyle(Button::Subtle);
back->setVisible(view->isCompact());
detail->addWidget(back, 0, Qt::AlignLeft);
detail->addWidget(new Label("Meeting note", view->detailPane()));
auto* editor = new LineEdit(view->detailPane());
editor->setAccessibleName("Note draft");
editor->setText("Discuss the next release");
detail->addWidget(editor);
detail->addStretch();
connect(open, &Button::clicked, view, &fluent::layout::ListDetailView::showDetail);
connect(back, &Button::clicked, view, &fluent::layout::ListDetailView::showList);
connect(view, &fluent::layout::ListDetailView::compactChanged, back, &QWidget::setVisible);
connect(width, qOverload<int>(&ComboBox::currentIndexChanged), view, [view](int index) {
    view->setMaximumWidth(index == 0 ? 640 : 360);
});

fluent::layout::ListDetailView

継承元 QWidget · FluentElement · QMLPlus

幅のしきい値を下回るとシングルペインモードに切り替わる、2 つの常時表示ペインです。

コンストラクタ

列挙型

enum Pane

コンパクトモードで現在選択されている表示先。ワイドモードでは両方のペインが表示されます。

  • List
  • Detail

メソッド

QWidget* listPane() const

ビューが所有するリストペインコンテナを返します。

QWidget* detailPane() const

ビューが所有する詳細ペインコンテナを返します。

void setCompactThreshold(int width)

currentPane のみを表示する幅のしきい値を設定します(最小値は 1)。

void setListPaneWidth(int width)

ワイドリストの幅を設定します(利用可能な幅の半分までに制限されます)。

プロパティ

bool compact
読み取り isCompact()通知シグナル compactChanged()
int compactThreshold
読み取り compactThreshold()書き込み setCompactThreshold()通知シグナル compactThresholdChanged()
int listPaneWidth
読み取り listPaneWidth()書き込み setListPaneWidth()通知シグナル listPaneWidthChanged()
Pane currentPane
読み取り currentPane()書き込み setCurrentPane()通知シグナル currentPaneChanged()

シグナル

protected メンバー

メソッド

fluent::FluentElement から継承

列挙型

enum Theme

デザイントークン解決時に使用されるグローバルな視覚テーマ。

  • Light = 0
  • Dark = 1
  • HighContrast = 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 にバインドします。

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