Fluent-Qt

Dialogs & flyouts

TeachingTip

An anchored tip that draws attention to a feature without blocking interaction.

Example

TeachingTip: Targeted tip with close reasons

Usage

Targeted tip with close reasons

TeachingTip points at a target, can light-dismiss, and reports how it was closed.

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

auto* tip = new TeachingTip(window());
tip->setPreferredPlacement(TeachingTip::Right);
tip->setLightDismissEnabled(true);
tip->setCardSize(QSize(320, 154));
connect(tip, &TeachingTip::closing, status,
        [status](TeachingTip::CloseReason reason) { updateStatus(reason); });
tip->showAt(targetButton);

fluent::dialogs_flyouts::TeachingTip

Inherits Popup

Contextual teaching flyout with target placement and optional tail.

Constructors

Properties

QWidget* target

Target widget used for teaching-tip anchoring.

Read target()Write setTarget()Notify targetChanged()
PreferredPlacement preferredPlacement

Preferred teaching-tip placement around the target.

Read preferredPlacement()Write setPreferredPlacement()Notify preferredPlacementChanged()
int placementMargin

Margin kept between teaching tip and target.

Read placementMargin()Write setPlacementMargin()Notify placementMarginChanged()
bool lightDismissEnabled

Whether outside interaction dismisses the teaching tip.

Read isLightDismissEnabled()Write setLightDismissEnabled()Notify lightDismissEnabledChanged()
bool tailVisible

Whether the teaching-tip tail is painted.

Read isTailVisible()Write setTailVisible()Notify tailVisibleChanged()

Methods

QWidget* target() const

Target widget used for teaching-tip anchoring.

void setTarget(QWidget* target)

Target widget used for teaching-tip anchoring.

PreferredPlacement preferredPlacement() const

Preferred teaching-tip placement around the target.

void setPreferredPlacement(PreferredPlacement placement)

Preferred teaching-tip placement around the target.

int placementMargin() const

Margin kept between teaching tip and target.

void setPlacementMargin(int margin)

Margin kept between teaching tip and target.

bool isLightDismissEnabled() const

Whether outside interaction dismisses the teaching tip.

void setLightDismissEnabled(bool enabled)

Whether outside interaction dismisses the teaching tip.

bool isTailVisible() const

Whether the teaching-tip tail is painted.

void setTailVisible(bool visible)

Whether the teaching-tip tail is painted.

QWidget* contentHost() const

Card content host: add child widgets (AnchorLayout etc.) to it. Its geometry follows placement/cardSize automatically.

void setCardSize(const QSize& size)

Sets the card content size, excluding shadow and tail. Defaults to 360×200.

Signals

void targetChanged(QWidget* target)

Target widget used for teaching-tip anchoring.

void preferredPlacementChanged(PreferredPlacement placement)

Preferred teaching-tip placement around the target.

void placementMarginChanged(int margin)

Margin kept between teaching tip and target.

void lightDismissEnabledChanged(bool enabled)

Whether outside interaction dismisses the teaching tip.

void tailVisibleChanged(bool visible)

Whether the teaching-tip tail is painted.

Enumerations

enum PreferredPlacement
  • Auto
  • Top
  • TopLeft
  • TopRight
  • Bottom
  • BottomLeft
  • BottomRight
  • Left
  • LeftTop
  • LeftBottom
  • Right
  • RightTop
  • RightBottom
enum CloseReason
  • Programmatic = Popup::Programmatic
  • ActionButton = Popup::ActionButton
  • CloseButton = Popup::CloseButton
  • LightDismiss = Popup::LightDismiss
  • TargetDestroyed = Popup::TargetDestroyed
Subclass interfaces

Methods

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