ダイアログとポップアップ
Dialog ダイアログ
カスタムコンテンツをモーダルまたはモードレスで表示できる同一ウィンドウ内のダイアログです。
サンプル
プロパティプレビューを読み込めませんでした。もう一度「プロパティプレビュー」を選択して再試行してください。

使い方
プロジェクト名の変更
Dialog 内にタイトル、入力欄、操作ボタンを配置します。ウィンドウの他の部分との操作をブロックする場合は setModal(true) を呼び出します。
#include <FluentQt/DialogsFlyouts.h>
using namespace fluent::dialogs_flyouts;
auto* root = new QWidget(this);
auto* layout = new QVBoxLayout(root);
auto* open = new Button(QStringLiteral("Rename project"), root);
open->setFluentStyle(Button::Accent);
auto* status = new Label(QStringLiteral("Project name: Northwind Analytics"), root);
layout->addWidget(open, 0, Qt::AlignLeft);
layout->addWidget(status);
QObject::connect(open, &Button::clicked, root, [open, status] {
auto* dialog = new Dialog(open->window());
dialog->setThemeSource(open);
dialog->setMinimumSize(480, 280);
auto* content = new QVBoxLayout(dialog);
content->setContentsMargins(32, 28, 32, 28);
content->setSpacing(14);
auto* title = new Label(QStringLiteral("Rename project"), dialog);
title->setFluentTypography(Typography::FontRole::Subtitle);
content->addWidget(title);
auto* name = new LineEdit(dialog);
name->setAccessibleName(QStringLiteral("Project name"));
name->setText(status->text().replace(QStringLiteral("Project name: "), QString()));
content->addWidget(name);
content->addStretch();
auto* commands = new QHBoxLayout;
auto* cancel = new Button(QStringLiteral("Cancel"), dialog);
auto* apply = new Button(QStringLiteral("Apply"), dialog);
apply->setFluentStyle(Button::Accent);
commands->addStretch();
commands->addWidget(cancel);
commands->addWidget(apply);
content->addLayout(commands);
QObject::connect(cancel, &Button::clicked, dialog, &QDialog::reject);
QObject::connect(apply, &Button::clicked, dialog, &QDialog::accept);
QObject::connect(dialog, &QDialog::accepted, status, [status, name] {
status->setText(QStringLiteral("Project name: %1").arg(name->text()));
});
QObject::connect(dialog, &QDialog::finished, dialog, &QObject::deleteLater);
dialog->open();
});
return root;import fluentqt
from PySide6.QtCore import Qt
from PySide6.QtWidgets import QHBoxLayout, QVBoxLayout
layout = QVBoxLayout(root)
open_button = fluentqt.Button('Rename project')
open_button.setFluentStyle(fluentqt.Button.ButtonStyle.Accent)
status = fluentqt.Label('Project name: Northwind Analytics')
layout.addWidget(open_button, 0, Qt.AlignmentFlag.AlignLeft)
layout.addWidget(status)
def rename_project():
dialog = fluentqt.Dialog(open_button.window())
dialog.setThemeSource(open_button)
dialog.setMinimumSize(480, 280)
content = QVBoxLayout(dialog)
content.setContentsMargins(32, 28, 32, 28)
content.setSpacing(14)
title = fluentqt.Label('Rename project', dialog)
title.setFluentTypography(fluentqt.FontRole.Subtitle)
content.addWidget(title)
name = fluentqt.LineEdit(dialog)
name.setAccessibleName('Project name')
name.setText(status.text().replace('Project name: ', ''))
content.addWidget(name)
content.addStretch()
commands = QHBoxLayout()
cancel = fluentqt.Button('Cancel', dialog)
apply = fluentqt.Button('Apply', dialog)
apply.setFluentStyle(fluentqt.Button.ButtonStyle.Accent)
commands.addStretch()
commands.addWidget(cancel)
commands.addWidget(apply)
content.addLayout(commands)
cancel.clicked.connect(dialog.reject)
apply.clicked.connect(dialog.accept)
dialog.accepted.connect(lambda: status.setText(f'Project name: {name.text()}'))
dialog.finished.connect(dialog.deleteLater)
dialog.open()
open_button.clicked.connect(rename_project)API
宣言を表示一致する API メンバーはありません。
fluent::dialogs_flyouts::Dialog
継承元 QDialog · FluentElement · QMLPlus
オプションのスモークスクリムとフェードアニメーションを備えた、同一ウィンドウ内の Fluent ダイアログホストです。
コンストラクタ
デストラクタ
列挙型
enum CloseFlagオーバーレイのライトディスミスフラグ。ビット構成は Popup::CloseFlag と同じです。
NoAutoClose = 0CloseOnPressOutside = 1 << 0CloseOnEscape = 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 でぼかし無効)。
型とエイリアス
protected メンバー
メソッド
QWidget* ownerWidget() const中央配置、テーマ継承、およびスモークスクリムに使用する所有側のトップレベルウィンドウ。
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 基底クラスドキュメント:QDialog