Dialogs & flyouts
Dialog
A modal window surface that hosts arbitrary content above the app.
Example

Usage
Rename a project
Edit a project name, then apply the change or cancel to keep the original.
#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
DeclarationNo matching API members.
fluent::dialogs_flyouts::Dialog
Inherits QDialog · FluentElement · QMLPlus
Same-window Fluent dialog shell with optional smoke scrim and enter/exit fade.
Constructors
Properties
bool isOpenLogical requested open state, not animation-complete or QWidget visibility.
ReadisOpen()WritesetIsOpen()NotifyisOpenChanged()double animationProgress- Read
animationProgress()WritesetAnimationProgress() bool dragEnabled- Read
isDragEnabled()WritesetDragEnabled()NotifydragEnabledChanged() bool animationEnabled- Read
isAnimationEnabled()WritesetAnimationEnabled()NotifyanimationEnabledChanged() bool smokeEnabledHistorical smoke bundle; enabled only while modal and dim are both on.
ReadisSmokeEnabled()WritesetSmokeEnabled()NotifysmokeEnabledChanged()bool modal- Read
isModal()WritesetModal()NotifymodalChanged() bool dim- Read
isDim()WritesetDim()NotifydimChanged() double dimOpacityScrim opacity in [0, 1]; -1 uses the theme smoke token when dim is enabled.
ReaddimOpacity()WritesetDimOpacity()NotifydimOpacityChanged()double backdropBlurRadiusCached owning-window blur radius in logical pixels [0, 32]; 0 disables blur.
ReadbackdropBlurRadius()WritesetBackdropBlurRadius()NotifybackdropBlurRadiusChanged()ClosePolicy closePolicy- Read
closePolicy()WritesetClosePolicy()NotifyclosePolicyChanged()
Methods
bool isOpen() constLogical requested open state, not animation-complete or QWidget visibility.
void setSmokeEnabled(bool enabled)Historical smoke bundle; enabled only while modal and dim are both on.
bool isSmokeEnabled() constHistorical smoke bundle; enabled only while modal and dim are both on.
double dimOpacity() constScrim opacity in [0, 1]; -1 uses the theme smoke token when dim is enabled.
void setDimOpacity(double opacity)Scrim opacity in [0, 1]; -1 uses the theme smoke token when dim is enabled.
double backdropBlurRadius() constCached owning-window blur radius in logical pixels [0, 32]; 0 disables blur.
void setBackdropBlurRadius(double radius)Cached owning-window blur radius in logical pixels [0, 32]; 0 disables blur.
void refreshBackdrop()Recaptures the owning-window content after background changes.
void setThemeSource(QWidget* source)Uses a widget as the local theme source while the dialog is shown.
void setIsOpen(bool open)Logical requested open state, not animation-complete or QWidget visibility.
Signals
void isOpenChanged(bool open)Logical requested open state, not animation-complete or QWidget visibility.
void opening()Opening transition started. Compatibility alias: aboutToShow().
void closing()Closing transition started. Compatibility alias: aboutToHide().
void smokeEnabledChanged(bool enabled)Historical smoke bundle; enabled only while modal and dim are both on.
void dimOpacityChanged(double opacity)Scrim opacity in [0, 1]; -1 uses the theme smoke token when dim is enabled.
void backdropBlurRadiusChanged(double radius)Cached owning-window blur radius in logical pixels [0, 32]; 0 disables blur.
Enumerations
enum CloseFlagOverlay light-dismiss flags; same bits as Popup::CloseFlag.
NoAutoClose = 0CloseOnPressOutside = 1 << 0CloseOnEscape = 1 << 1
Types and aliases
Destructors
Subclass interfaces
Methods
QWidget* ownerWidget() constOwning top-level used for centering, theme inheritance, and the smoke scrim.
Inherited from fluent::FluentElement
Methods
static void setTheme(Theme theme)Updates the global theme and notifies active FluentElement instances.
static void setThemeDeferred(Theme theme)Schedules a visible-first batched theme refresh without blocking the current interaction.
static Theme currentTheme()Returns the currently active global theme.
static bool themeUsesDarkAppearance(Theme theme)Returns whether a theme uses dark-backed chrome and material tokens.
static void refreshTheme()Re-broadcasts the current theme to repaint after a design-token change.
static int themeGeneration()Monotonic counter bumped on every theme change, for staleness checks.
Theme effectiveTheme() constResolves the theme used by this element, honoring an inherited QWidget override.
bool effectiveThemeUsesDarkAppearance() constReturns whether this element's effective theme uses dark-backed chrome.
bool setThemeOverrides(const QJsonObject& overrides)Component-facing token accessors.
QJsonObject themeOverrides() constReturns this element's authored overrides.
void clearThemeOverrides()Restores all token fields to global theme defaults.
const Colors& themeColorsRef() constNon-copying access to the active color set (for hot paint paths).
Material::AcrylicToken themeAcrylic() constMaterial, elevation, and adaptive layout tokens.
QColor themeBackdrop(bool active) constWindow-chrome backdrop color for the given activation state.
virtual void onThemeUpdated()Called after the global theme changes.
Enumerations
enum ThemeGlobal visual theme used when resolving design tokens.
Light = 0Dark = 1HighContrast = 2
Types and aliases
struct ColorsDesign token snapshots returned to components.
Inherited from fluent::QMLPlus
Methods
AnchorLayout::Anchors* anchors()Returns mutable anchors for the QWidget host.
void setState(const QString& name)Applies a named state, or clears state when name is empty.
void addState(const QMLState& state)Registers or replaces a named state definition.
void evaluateStates()Reevaluates conditions; the first registered true condition wins.
QMLPlusRuntime* runtime()Returns the lazy host-owned state observation object.
void setAnchors(const AnchorLayout::Anchors& anchors)Replaces all host anchors and invalidates the parent layout.
void resetAnchors()Clears all host anchors and invalidates the parent layout.
void bind(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction dir = PropertyBinder::OneWay)Binds a source property to a property on the QWidget host.
BindingHandle bindManaged(const char* targetProp, QObject* source, const char* sourceProp, PropertyBinder::Direction direction = PropertyBinder::OneWay, BindingOptions options = {})Installs a managed direct binding on this QWidget host.
BindingHandle bindComputed(const char* targetProp, const QVector<BindingDependency>& dependencies, std::function<QVariant()> evaluate, BindingOptions options = {})Installs an explicit-dependency C++ expression on this QWidget host.
void addTransition(const StateTransition& transition)Registers a state transition in precedence order.
void setBehavior(const char* propertyName, const PropertyAnimation& animation)Sets the default animation for this host's managed property writes.
void clearBehavior(const char* propertyName)Removes the default animation for future managed writes.
bool writeProperty(const char* propertyName, const QVariant& value)Writes a host property through Behavior without removing its binding.
All inherited Qt members:QDialog