Fluent-Qt

ダイアログとポップアップ

ContentDialog コンテンツダイアログ

タイトル、コンテンツ、および最大3つの確定ボタンを備えたモーダルダイアログです。

サンプル

ContentDialog コンテンツダイアログ: 結果ボタンと既定のコマンド

使い方

結果ボタンと既定のコマンド

プライマリ、セカンダリ、閉じるの各ボタンでアプリの状態を更新し、プライマリコマンドが既定のアクションになります。

#include <FluentQt/DialogsFlyouts.h>
using namespace fluent::dialogs_flyouts;

auto* dialog = new ContentDialog(window());
dialog->setTitle("Save your work?");
dialog->setContent(new Label("Unsaved changes in Quarterly report will be lost unless you save them."));
dialog->setPrimaryButtonText("Save");
dialog->setSecondaryButtonText("Don't save");
dialog->setCloseButtonText("Cancel");
dialog->setDefaultButton(ContentDialog::Primary);
connect(dialog, &QDialog::finished, this, [this](int result) {
    const QString message = result == ContentDialog::Primary ? "Save selected"
        : result == ContentDialog::Secondary ? "Don't save selected" : "Cancelled";
    Toast::showOrUpdateToast(this, "gallery.action-feedback", message,
        Toast::Informational, 2200, Toast::Top, QMargins(16, 50, 16, 16));
});
connect(dialog, &QDialog::finished, dialog, &QObject::deleteLater);
dialog->open();

fluent::dialogs_flyouts::ContentDialog

継承元 Dialog

タイトル、コンテンツ領域、アクションボタンを備えた WinUI スタイルのコンテンツダイアログ。

定数

コンストラクタ

列挙型

enum ContentDialogButton
  • None = 0
  • Primary
  • Secondary
  • Close

メソッド

QString title() const

ダイアログヘッダーに表示されるタイトルテキストです。

void setTitle(const QString& text)

ダイアログヘッダーに表示されるタイトルテキストです。

QString primaryButtonText() const

プライマリコマンドボタンに表示されるテキストです。

void setPrimaryButtonText(const QString& text)

プライマリコマンドボタンに表示されるテキストです。

QString secondaryButtonText() const

セカンダリコマンドボタンに表示されるテキストです。

void setSecondaryButtonText(const QString& text)

セカンダリコマンドボタンに表示されるテキストです。

QString closeButtonText() const

閉じるコマンドボタンに表示されるテキストです。

void setCloseButtonText(const QString& text)

閉じるコマンドボタンに表示されるテキストです。

int defaultButton() const

デフォルトアクションとして強調表示されるコマンドボタン。

void setDefaultButton(int btn)

デフォルトアクションとして強調表示されるコマンドボタン。

void setButtonBarHeight(int px)

下部ボタンバーの高さを上書きします(既定値は 68 px)。

プロパティ

QString title

ダイアログヘッダーに表示されるタイトルテキストです。

読み取り title()書き込み setTitle()通知シグナル titleChanged()
QString primaryButtonText

プライマリコマンドボタンに表示されるテキストです。

読み取り primaryButtonText()書き込み setPrimaryButtonText()通知シグナル primaryButtonTextChanged()
QString secondaryButtonText

セカンダリコマンドボタンに表示されるテキストです。

読み取り secondaryButtonText()書き込み setSecondaryButtonText()通知シグナル secondaryButtonTextChanged()
QString closeButtonText

閉じるコマンドボタンに表示されるテキストです。

読み取り closeButtonText()書き込み setCloseButtonText()通知シグナル closeButtonTextChanged()
int defaultButton

デフォルトアクションとして強調表示されるコマンドボタン。

読み取り defaultButton()書き込み setDefaultButton()通知シグナル defaultButtonChanged()

シグナル

void titleChanged(const QString& text)

ダイアログヘッダーに表示されるタイトルテキストです。

void primaryButtonTextChanged(const QString& text)

プライマリコマンドボタンに表示されるテキストです。

void secondaryButtonTextChanged(const QString& text)

セカンダリコマンドボタンに表示されるテキストです。

void closeButtonTextChanged(const QString& text)

閉じるコマンドボタンに表示されるテキストです。

void defaultButtonChanged(int btn)

デフォルトアクションとして強調表示されるコマンドボタン。

PySide6 拡張

takeContent()

設定されているコンテンツを切り離し、所有権を Python に移して返します。

protected メンバー

メソッド

fluent::dialogs_flyouts::Dialog から継承

列挙型

enum CloseFlag

オーバーレイのライトディスミスフラグ。ビット構成は Popup::CloseFlag と同じです。

  • NoAutoClose = 0
  • CloseOnPressOutside = 1 << 0
  • CloseOnEscape = 1 << 1

メソッド

bool isOpen() const

要求された展開状態です(アニメーションの進行状況やウィジェットの可視性とは独立しています)。

void setSmokeEnabled(bool enabled)

互換用の統合トグルです。modal と dim の両方が有効な間のみ true になります。

bool isSmokeEnabled() const

互換用の統合トグルです。modal と dim の両方が有効な間のみ true になります。

double dimOpacity() const

[0, 1] の範囲のスクリム不透明度です。dim が有効な場合、-1 でテーマのスモークトークンを使用します。

void setDimOpacity(double opacity)

[0, 1] の範囲のスクリム不透明度です。dim が有効な場合、-1 でテーマのスモークトークンを使用します。

double backdropBlurRadius() const

キャプチャされたウィンドウ背景のぼかし半径(論理ピクセル [0, 32]、0 でぼかし無効)。

void setBackdropBlurRadius(double radius)

キャプチャされたウィンドウ背景のぼかし半径(論理ピクセル [0, 32]、0 でぼかし無効)。

void refreshBackdrop()

背景の変更後に所有ウィンドウのコンテンツを再キャプチャします。

void setThemeSource(QWidget* source)

ダイアログの表示中、ウィジェットをローカルテーマソースとして使用します。

void setIsOpen(bool open)

要求された展開状態です(アニメーションの進行状況やウィジェットの可視性とは独立しています)。

プロパティ

bool isOpen

要求された展開状態です(アニメーションの進行状況やウィジェットの可視性とは独立しています)。

読み取り isOpen()書き込み setIsOpen()通知シグナル isOpenChanged()
double animationProgress
読み取り animationProgress()書き込み setAnimationProgress()
bool dragEnabled
読み取り isDragEnabled()書き込み setDragEnabled()通知シグナル dragEnabledChanged()
bool animationEnabled
読み取り isAnimationEnabled()書き込み setAnimationEnabled()通知シグナル animationEnabledChanged()
bool smokeEnabled

互換用の統合トグルです。modal と dim の両方が有効な間のみ true になります。

読み取り isSmokeEnabled()書き込み setSmokeEnabled()通知シグナル smokeEnabledChanged()
bool modal
読み取り isModal()書き込み setModal()通知シグナル modalChanged()
bool dim
読み取り isDim()書き込み setDim()通知シグナル dimChanged()
double dimOpacity

[0, 1] の範囲のスクリム不透明度です。dim が有効な場合、-1 でテーマのスモークトークンを使用します。

読み取り dimOpacity()書き込み setDimOpacity()通知シグナル dimOpacityChanged()
double backdropBlurRadius

キャプチャされたウィンドウ背景のぼかし半径(論理ピクセル [0, 32]、0 でぼかし無効)。

読み取り backdropBlurRadius()書き込み setBackdropBlurRadius()通知シグナル backdropBlurRadiusChanged()
ClosePolicy closePolicy
読み取り closePolicy()書き込み setClosePolicy()通知シグナル closePolicyChanged()

シグナル

void isOpenChanged(bool open)

要求された展開状態です(アニメーションの進行状況やウィジェットの可視性とは独立しています)。

void opening()

開くトランジションが開始されました。互換エイリアス:aboutToShow()。

void closing()

閉じるトランジションが開始されました。互換エイリアス: aboutToHide()。

void smokeEnabledChanged(bool enabled)

互換用の統合トグルです。modal と dim の両方が有効な間のみ true になります。

void dimOpacityChanged(double opacity)

[0, 1] の範囲のスクリム不透明度です。dim が有効な場合、-1 でテーマのスモークトークンを使用します。

void backdropBlurRadiusChanged(double radius)

キャプチャされたウィンドウ背景のぼかし半径(論理ピクセル [0, 32]、0 でぼかし無効)。

型とエイリアス

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 基底クラスドキュメント:QDialog