レイアウト
Accordion アコーディオン
単一または複数展開に対応した、縦に並ぶ展開可能セクションのグループを制御します。
サンプル
プロパティプレビューを読み込めませんでした。もう一度「プロパティプレビュー」を選択して再試行してください。

使い方
単一展開
Single モードでは、別のヘッダーを開くと前のセクションが閉じます。
#include <FluentQt/Layout.h>
using namespace fluent::layout;
auto* accordion = new Accordion(this);
accordion->setExpansionMode(
Accordion::ExpansionMode::Single);
accordion->setFixedWidth(520);
auto makeSection = [](const QString& title,
const QString& detail) {
auto* item = new Expander;
item->setHeaderText(title);
auto* body = new QWidget;
auto* bodyLayout = new QVBoxLayout(body);
bodyLayout->setContentsMargins(16, 12, 16, 14);
bodyLayout->addWidget(
new Label("Additional details", body));
bodyLayout->addWidget(new Label(detail, body));
item->setContentWidget(
body, WidgetOwnership::Owned);
return item;
};
accordion->addItem(
makeSection("Account",
"Profile, sign-in, and recovery options."),
WidgetOwnership::Owned);
accordion->addItem(
makeSection("Notifications",
"Choose which activity can interrupt you."),
WidgetOwnership::Owned);
accordion->addItem(
makeSection("Privacy",
"Review diagnostics and personalization settings."),
WidgetOwnership::Owned);
accordion->itemAt(0)->setExpandedAnimated(true, false);import fluentqt
from PySide6.QtWidgets import QVBoxLayout, QWidget
accordion = fluentqt.Accordion()
accordion.setExpansionMode(fluentqt.Accordion.ExpansionMode.Single)
accordion.setFixedWidth(520)
def make_section(title, detail):
item = fluentqt.Expander()
item.setHeaderText(title)
body = QWidget()
body_layout = QVBoxLayout(body)
body_layout.setContentsMargins(16, 12, 16, 14)
body_layout.addWidget(
fluentqt.Label("Additional details", body)
)
body_layout.addWidget(fluentqt.Label(detail, body))
item.setOwnedContentWidget(body)
return item
account = make_section("Account", "Profile, sign-in, and recovery options.")
notifications = make_section(
"Notifications",
"Choose which activity can interrupt you."
)
privacy = make_section(
"Privacy",
"Review diagnostics and personalization settings."
)
accordion.addOwnedItem(account)
accordion.addOwnedItem(notifications)
accordion.addOwnedItem(privacy)
account.setExpandedAnimated(True, False)API
宣言を表示一致する API メンバーはありません。
fluent::layout::Accordion
継承元 QWidget · FluentElement · QMLPlus
展開状態とキーボードナビゲーションを連携させる Expander 項目の垂直コンテナです。項目はデフォルトで WidgetOwnership::Borrowed となり、クリーンアップ方法を復元または移譲するには WidgetOwnership を渡します。
コンストラクタ
デストラクタ
列挙型
enum class ExpansionMode1 つまたは複数のアイテムを展開できるかどうかを制御します。
SingleMultiple
メソッド
bool addItem(Expander* item)Expander 項目を末尾に追加します(WidgetOwnership::Borrowed のため Accordion によって削除されません)。
bool addItem(Expander* item, WidgetOwnership ownership)指定された WidgetOwnership 解放モードで Expander 項目を末尾に追加します。
bool insertItem(int index, Expander* item)index の位置に Expander 項目を挿入します(WidgetOwnership::Borrowed となり、Accordion によって削除されません)。
bool insertItem(int index, Expander* item, WidgetOwnership ownership)指定した WidgetOwnership クリーンアップモードで、index の位置に Expander 項目を挿入します。
bool removeItem(int index)index の項目を削除し、その WidgetOwnership モードに従ってクリーンアップを処理します。
Expander* takeItem(int index)index の項目を削除して返し、呼び出し側で管理または破棄できるようにします。
プロパティ
ExpansionMode expansionMode- 読み取り
expansionMode()書き込みsetExpansionMode()通知シグナルexpansionModeChanged() int count- 読み取り
count()通知シグナルcountChanged()
シグナル
PySide6 拡張
addOwnedItem(item)末尾に項目を追加します。Accordion が破棄されると項目も削除されます。
addBorrowedItem(item)末尾に借用する項目を追加します。解放すると親から切り離されます。
addReparentedItem(item)末尾に項目を追加します。解放すると追加前の親 QWidget に戻ります。
insertOwnedItem(index, item)項目を挿入します。Accordion が破棄されると項目も削除されます。
insertBorrowedItem(index, item)借用する項目を挿入します。解放すると親から切り離されます。
insertReparentedItem(index, item)項目を挿入します。解放すると挿入前の親 QWidget に戻ります。
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