Dialogs & flyouts
ContentDialog
A modal dialog with title, content, and up to three commit buttons.
Example

Usage
Result buttons and default command
Primary, secondary, and close buttons update app state while the primary command is the default action.
#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();import fluentqt
from PySide6.QtCore import QMargins
dialog = fluentqt.ContentDialog(window)
dialog.setTitle("Save your work?")
dialog.setContent(
fluentqt.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(fluentqt.ContentDialog.Primary)
def finished(result):
if result == fluentqt.ContentDialog.Primary:
message = "Save selected"
elif result == fluentqt.ContentDialog.Secondary:
message = "Don't save selected"
else:
message = "Cancelled"
fluentqt.Toast.showOrUpdateToast(
window,
"gallery.action-feedback",
message,
fluentqt.Toast.Informational,
2200,
fluentqt.Toast.Top,
QMargins(16, 50, 16, 16)
)
dialog.finished.connect(finished)
dialog.finished.connect(dialog.deleteLater)
dialog.open()API
DeclarationNo matching API members.
fluent::dialogs_flyouts::ContentDialog
Inherits Dialog
WinUI-style content dialog with title, content, and command buttons.
Constructors
Properties
QString titleTitle text displayed by the surface.
Readtitle()WritesetTitle()NotifytitleChanged()QString primaryButtonTextText displayed by the primary command button.
ReadprimaryButtonText()WritesetPrimaryButtonText()NotifyprimaryButtonTextChanged()QString secondaryButtonTextText displayed by the secondary command button.
ReadsecondaryButtonText()WritesetSecondaryButtonText()NotifysecondaryButtonTextChanged()QString closeButtonTextText displayed by the close command button.
ReadcloseButtonText()WritesetCloseButtonText()NotifycloseButtonTextChanged()int defaultButtonCommand button selected as the default action.
ReaddefaultButton()WritesetDefaultButton()NotifydefaultButtonChanged()
Methods
QString title() const--- Title ---
void setTitle(const QString& text)Title text displayed by the surface.
QString primaryButtonText() const--- Button text ---
void setPrimaryButtonText(const QString& text)Text displayed by the primary command button.
QString secondaryButtonText() constText displayed by the secondary command button.
void setSecondaryButtonText(const QString& text)Text displayed by the secondary command button.
QString closeButtonText() constText displayed by the close command button.
void setCloseButtonText(const QString& text)Text displayed by the close command button.
int defaultButton() const--- DefaultButton ---
void setDefaultButton(int btn)Command button selected as the default action.
QWidget* content() const--- Content ---
void setButtonBarHeight(int px)--- Command bar --- Overrides the standard command-bar height (default 68px) for compact, bespoke prompts. Leave at the default to match the WinUI ContentDialog.
Signals
void titleChanged(const QString& text)Title text displayed by the surface.
void primaryButtonTextChanged(const QString& text)Text displayed by the primary command button.
void secondaryButtonTextChanged(const QString& text)Text displayed by the secondary command button.
void closeButtonTextChanged(const QString& text)Text displayed by the close command button.
void defaultButtonChanged(int btn)Command button selected as the default action.
Enumerations
enum ContentDialogButtonNone = 0PrimarySecondaryClose
Constants
PySide6 additions
takeContent()Detach and return the installed content to Python ownership.
Subclass interfaces
Methods
Inherited from fluent::dialogs_flyouts::Dialog
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
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