Fluent-Qt

Dialogs & flyouts

Flyout

A light-dismiss container anchored to the control that opened it.

Example

Flyout: Anchored placement

Usage

Anchored placement

Flyout positions itself around an anchor and can fall back automatically near edges.

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

auto* flyout = new Flyout(window());
flyout->setPlacement(Flyout::Right);
populateFlyout(flyout);
connect(flyout, &Popup::closed, flyout, &QObject::deleteLater);
flyout->showAt(anchorButton);

fluent::dialogs_flyouts::Flyout

Inherits Popup

Popup anchored to a target with placement and window clamping rules.

Constructors

Properties

Placement placement

Preferred flyout placement relative to its anchor.

Read placement()Write setPlacement()Notify placementChanged()
int anchorOffset

Offset from the anchor edge in pixels.

Read anchorOffset()Write setAnchorOffset()Notify anchorOffsetChanged()
bool clampToWindow

Whether flyout geometry is clamped to the host window.

Read clampToWindow()Write setClampToWindow()Notify clampToWindowChanged()

Methods

Placement placement() const

Preferred flyout placement relative to its anchor.

void setPlacement(Placement p)

Preferred flyout placement relative to its anchor.

int anchorOffset() const

Offset from the anchor edge in pixels.

void setAnchorOffset(int px)

Offset from the anchor edge in pixels.

bool clampToWindow() const

Whether flyout geometry is clamped to the host window.

void setClampToWindow(bool e)

Whether flyout geometry is clamped to the host window.

void showAt(QWidget* anchor)

Opens the flyout at the anchor; equals setAnchor(anchor) + open().

void setAnchor(QWidget* anchor)

Sets the anchor without opening.

Signals

void placementChanged(Placement p)

Preferred flyout placement relative to its anchor.

void anchorOffsetChanged(int px)

Offset from the anchor edge in pixels.

void clampToWindowChanged(bool enabled)

Whether flyout geometry is clamped to the host window.

Enumerations

enum Placement
  • Top Above the anchor.
  • Bottom Below the anchor.
  • Left Left of the anchor.
  • Right Right of the anchor.
  • Full Centered in the top-level window (base-class default).
  • Auto Prefer Bottom, flipping to Top when space runs out.

Destructors

Subclass interfaces

Methods

QPoint computePosition() const override

Override: computes the move() target from the anchor geometry, the placement, and the flyout size (including shadow-margin compensation).

Inherited from fluent::dialogs_flyouts::Popup

Properties

bool isOpen

Logical requested open state, not animation-complete or QWidget visibility.

Read isOpen()Write setIsOpen()Notify isOpenChanged()
ClosePolicy closePolicy

Policy controlling outside-click, escape, or programmatic close behavior.

Read closePolicy()Write setClosePolicy()Notify closePolicyChanged()
bool modal

Whether the overlay blocks interaction outside itself.

Read isModal()Write setModal()Notify modalChanged()
bool dim

Whether a dim/scrim layer is shown behind the overlay.

Read isDim()Write setDim()Notify dimChanged()
double dimOpacity

Scrim opacity in [0, 1]; -1 uses the theme smoke token. Only applies when dim is enabled.

Read dimOpacity()Write setDimOpacity()Notify dimOpacityChanged()
double backdropBlurRadius

Cached content-backdrop blur radius in logical pixels [0, 32]; 0 disables blur. Defaults to 4 for modal surfaces and 0 otherwise until explicitly set. Explicit values, including 0, persist across modality changes.

Read backdropBlurRadius()Write setBackdropBlurRadius()Notify backdropBlurRadiusChanged()
bool animationEnabled

Whether popup open/close transitions are animated.

Read isAnimationEnabled()Write setAnimationEnabled()Notify animationEnabledChanged()
double popupProgress

Popup open/close animation progress.

Read popupProgress()Write setPopupProgress()Notify popupProgressChanged()

Methods

bool isOpen() const

Logical requested open state, not animation-complete or QWidget visibility.

ClosePolicy closePolicy() const

Policy controlling outside-click, escape, or programmatic close behavior.

void setClosePolicy(ClosePolicy p)

Policy controlling outside-click, escape, or programmatic close behavior.

bool isModal() const

Whether the overlay blocks interaction outside itself.

void setModal(bool m)

Whether the overlay blocks interaction outside itself.

bool lightDismissConsumesPress() const

When true, a CloseOnPressOutside light-dismiss SWALLOWS the dismissing press instead of letting it fall through to whatever is underneath — ComboBox-dropdown semantics (one click only closes the popup; it does not also activate the control beneath). Default false keeps the menu-style behaviour where the dismiss click still hits its target.

void addLightDismissPassthrough(QWidget* widget)

Regions exempt from the consume above: a dismissing press that lands inside one of these widgets still falls through to it, so a sibling toolbar / nav bar stays one-click reachable while the popup closes. Only meaningful together with lightDismissConsumesPress.

bool isDim() const

Whether a dim/scrim layer is shown behind the overlay.

void setDim(bool d)

Whether a dim/scrim layer is shown behind the overlay.

double dimOpacity() const

Scrim opacity in [0, 1]; -1 uses the theme smoke token. Only applies when dim is enabled.

void setDimOpacity(double opacity)

Scrim opacity in [0, 1]; -1 uses the theme smoke token. Only applies when dim is enabled.

double backdropBlurRadius() const

Cached content-backdrop blur radius in logical pixels [0, 32]; 0 disables blur. Defaults to 4 for modal surfaces and 0 otherwise until explicitly set. Explicit values, including 0, persist across modality changes.

void setBackdropBlurRadius(double radius)

Cached content-backdrop blur radius in logical pixels [0, 32]; 0 disables blur. Defaults to 4 for modal surfaces and 0 otherwise until explicitly set. Explicit values, including 0, persist across modality changes.

bool isAnimationEnabled() const

Whether popup open/close transitions are animated.

void setAnimationEnabled(bool e)

Whether popup open/close transitions are animated.

bool isExitAnimationEnabled() const

When false, close() skips the exit (fade-out) animation and hides instantly; the open/enter animation is unaffected. Lets a caller drop just the dismissal animation for a specific popup without touching the shared default — e.g. when the opacity-effect fade-out misbehaves over a native vibrancy backdrop on macOS.

void setThemeSource(QWidget* source)

Uses a widget as the local theme source when no anchor drives the popup.

double popupProgress() const

Popup open/close animation progress.

void setPopupProgress(double p)

Popup open/close animation progress.

void setPosition(QWidget* relativeTo, const QPoint& localPos)

Positions the popup's top-left in the given widget's local coordinates; with relativeTo == topLevelWidget this is window-relative. Coordinates reference the visible card corner; open() compensates the shadow margin. While open, the popup follows relativeTo and closes when it is fully clipped. Without a call, open() centers the popup.

void setIsOpen(bool open)

Logical requested open state, not animation-complete or QWidget visibility.

void refreshBackdrop()

Refreshes the cached backdrop after application content changes behind an open popup.

void closeWithReason(CloseReason reason)

Closes with an explicit reason; close() uses Programmatic unless a reason is pending.

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(CloseReason reason)

Closing transition started. aboutToHide() is the parameterless compatibility alias.

void popupProgressChanged(double progress)

Popup open/close animation progress.

void closePolicyChanged(ClosePolicy policy)

Policy controlling outside-click, escape, or programmatic close behavior.

void modalChanged(bool modal)

Whether the overlay blocks interaction outside itself.

void dimChanged(bool dim)

Whether a dim/scrim layer is shown behind the overlay.

void dimOpacityChanged(double opacity)

Scrim opacity in [0, 1]; -1 uses the theme smoke token. Only applies when dim is enabled.

void backdropBlurRadiusChanged(double radius)

Cached content-backdrop blur radius in logical pixels [0, 32]; 0 disables blur. Defaults to 4 for modal surfaces and 0 otherwise until explicitly set. Explicit values, including 0, persist across modality changes.

void animationEnabledChanged(bool enabled)

Whether popup open/close transitions are animated.

Enumerations

enum CloseFlag
  • NoAutoClose = 0
  • CloseOnPressOutside = 1 << 0
  • CloseOnEscape = 1 << 1
enum CloseReason

Why an overlay closed.

  • Programmatic = 0
  • ActionButton = 1
  • CloseButton = 2
  • LightDismiss = 3
  • TargetDestroyed = 4
  • Escape = 5

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() const

Resolves the theme used by this element, honoring an inherited QWidget override.

bool effectiveThemeUsesDarkAppearance() const

Returns whether this element's effective theme uses dark-backed chrome.

QJsonObject themeOverrides() const

Returns this element's authored overrides.

void clearThemeOverrides()

Restores all token fields to global theme defaults.

const Colors& themeColorsRef() const

Non-copying access to the active color set (for hot paint paths).

Material::AcrylicToken themeAcrylic() const

Material, elevation, and adaptive layout tokens.

QColor themeBackdrop(bool active) const

Window-chrome backdrop color for the given activation state.

virtual void onThemeUpdated()

Called after the global theme changes.

Enumerations

enum Theme

Global visual theme used when resolving design tokens.

  • Light = 0
  • Dark = 1
  • HighContrast = 2

Types and aliases

struct Colors

Design 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 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:QWidget