Status & info
Toast
Shows a brief same-window notification without interrupting the current task.
Example

Usage
Messages
Timely feedback, with a clear next step. Hover pauses the timeout; close or use an action to continue.
#include <FluentQt/StatusInfo.h>
using namespace fluent::status_info;
auto* panel = new QWidget(this);
auto* layout = new QVBoxLayout(panel);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(12);
auto* retry = new QAction("Try again", panel);
QObject::connect(retry, &QAction::triggered, panel, [panel]() {
Toast::showToast(panel, "Ready to retry", Toast::Success, 2200, Toast::TopEnd);
});
auto* review = new QAction("Review file", panel);
QObject::connect(review, &QAction::triggered, panel, [panel]() {
Toast::showToast(panel, "Choose a file under 20 MB", Toast::Informational, 3500, Toast::TopEnd);
});
auto* row = new QWidget(panel);
auto* buttons = new QHBoxLayout(row);
buttons->setContentsMargins(0, 0, 0, 0);
buttons->setSpacing(8);
const QStringList labels = {"Saved", "Copied", "Warning", "Error"};
for (int i = 0; i < labels.size(); ++i) {
auto* button = new Button(labels.at(i), row);
button->setObjectName(QStringLiteral("feedback%1").arg(i));
buttons->addWidget(button);
QObject::connect(button, &Button::clicked, panel, [panel, retry, review, i]() {
for (Toast* previous : panel->window()->findChildren<Toast*>("feedbackToast"))
previous->dismiss();
auto* toast = new Toast(panel);
toast->setObjectName("feedbackToast");
toast->setDuration(5500);
toast->setPlacement(Toast::TopEnd);
toast->setClosable(true);
toast->setPauseOnHoverEnabled(true);
if (i == 0 || i == 1) {
toast->setSeverity(i == 0 ? Toast::Success : Toast::Informational);
toast->setMessage(i == 0 ? "Changes saved" : "Link copied");
} else if (i == 2) {
toast->setSeverity(Toast::Warning);
toast->setTitle("One file needs attention");
toast->setMessage("archive.zip exceeds the 20 MB limit. The other files can continue.");
toast->setAction(review);
} else {
toast->setSeverity(Toast::Error);
toast->setTitle("Upload interrupted");
toast->setMessage("Your connection was lost. Try again to resume product-shot.png.");
toast->setAction(retry);
}
QObject::connect(panel, &QObject::destroyed, toast, &QObject::deleteLater);
QObject::connect(toast, &Toast::dismissed, toast, &QObject::deleteLater);
toast->present(panel);
});
}
buttons->addStretch();
layout->addWidget(row);import fluentqt
from PySide6.QtGui import QAction
from PySide6.QtWidgets import QHBoxLayout, QVBoxLayout, QWidget
panel = QWidget()
layout = QVBoxLayout(panel)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(12)
retry = QAction("Try again", panel)
retry.triggered.connect(
lambda: fluentqt.Toast.showToast(
panel,
"Ready to retry",
fluentqt.Toast.Severity.Success,
2200,
fluentqt.Toast.Placement.TopEnd
)
)
review = QAction("Review file", panel)
review.triggered.connect(
lambda: fluentqt.Toast.showToast(
panel,
"Choose a file under 20 MB",
fluentqt.Toast.Severity.Informational,
3500,
fluentqt.Toast.Placement.TopEnd
)
)
row = QWidget(panel)
buttons = QHBoxLayout(row)
buttons.setContentsMargins(0, 0, 0, 0)
buttons.setSpacing(8)
panel._feedback_toast = None
severity = fluentqt.Toast.Severity
def show_feedback(kind):
if panel._feedback_toast is not None:
panel._feedback_toast.dismiss()
toast = fluentqt.Toast(panel)
toast.setObjectName("feedbackToast")
toast.setDuration(5500)
toast.setPlacement(fluentqt.Toast.Placement.TopEnd)
toast.setClosable(True)
toast.setPauseOnHoverEnabled(True)
if kind in (0, 1):
toast.setSeverity(severity.Success if kind == 0 else severity.Informational)
toast.setMessage("Changes saved" if kind == 0 else "Link copied")
elif kind == 2:
toast.setSeverity(fluentqt.Toast.Severity.Warning)
toast.setTitle("One file needs attention")
toast.setMessage(
"archive.zip exceeds the 20 MB limit. The other files can continue."
)
toast.setAction(review)
else:
toast.setSeverity(fluentqt.Toast.Severity.Error)
toast.setTitle("Upload interrupted")
toast.setMessage(
"Your connection was lost. Try again to resume product-shot.png."
)
toast.setAction(retry)
def dismissed():
if panel._feedback_toast is toast:
panel._feedback_toast = None
toast.deleteLater()
toast.dismissed.connect(dismissed)
panel.destroyed.connect(toast.deleteLater)
toast.present(panel)
panel._feedback_toast = toast
for i, label in enumerate(("Saved", "Copied", "Warning", "Error")):
button = fluentqt.Button(label, row)
button.setObjectName(f"feedback{i}")
button.clicked.connect(lambda checked=False, i=i: show_feedback(i))
buttons.addWidget(button)
buttons.addStretch()
layout.addWidget(row)API
DeclarationNo matching API members.
fluent::status_info::Toast
Inherits QWidget · FluentElement · QMLPlus
Transient same-window notification with severity and edge placement.
Constructors
Properties
QString title- Read
title()WritesetTitle()NotifytitleChanged() QString message- Read
message()WritesetMessage()NotifymessageChanged() Severity severity- Read
severity()WritesetSeverity()NotifyseverityChanged() Placement placement- Read
placement()WritesetPlacement()NotifyplacementChanged() QMargins placementMargins- Read
placementMargins()WritesetPlacementMargins()NotifyplacementMarginsChanged() int duration- Read
duration()WritesetDuration()NotifydurationChanged() bool animationEnabled- Read
isAnimationEnabled()WritesetAnimationEnabled()NotifyanimationEnabledChanged() QAction* actionOptional caller-owned action presented inside the toast.
Readaction()WritesetAction()NotifyactionChanged()bool closableWhether a close button dismisses the toast with `CloseButton`.
ReadisClosable()WritesetClosable()NotifyclosableChanged()bool pauseOnHoverEnabledWhether an active duration timer pauses while the toast is hovered.
ReadisPauseOnHoverEnabled()WritesetPauseOnHoverEnabled()NotifypauseOnHoverEnabledChanged()QString updateKeyOptional key used by `showOrUpdateToast()` within one managed stack.
ReadupdateKey()WritesetUpdateKey()NotifyupdateKeyChanged()bool isOpen- Read
isOpen()NotifyisOpenChanged() qreal toastProgress- Read
toastProgress()WritesetToastProgress()
Methods
QAction* action() constOptional caller-owned action presented inside the toast.
void setAction(QAction* action)Optional caller-owned action presented inside the toast.
bool isClosable() constWhether a close button dismisses the toast with `CloseButton`.
void setClosable(bool closable)Whether a close button dismisses the toast with `CloseButton`.
bool isPauseOnHoverEnabled() constWhether an active duration timer pauses while the toast is hovered.
void setPauseOnHoverEnabled(bool enabled)Whether an active duration timer pauses while the toast is hovered.
QString updateKey() constOptional key used by `showOrUpdateToast()` within one managed stack.
void setUpdateKey(const QString& key)Optional key used by `showOrUpdateToast()` within one managed stack.
static int maximumVisible()Maximum managed toasts kept visible per host and placement.
bool present(QWidget* anchor)Presents this toast in the anchor's top-level window.
void dismiss()Dismisses the toast and ends its current display lifetime.
static Toast* showToast(QWidget* anchor, const QString& message, Severity severity = Informational, int durationMs = 2200, Placement placement = Top, const QMargins& margins = QMargins(16, 16, 16, 16))Creates a self-deleting toast and stacks it with other managed toasts.
static Toast* showOrUpdateToast(QWidget* anchor, const QString& updateKey, const QString& message, Severity severity = Informational, int durationMs = 2200, Placement placement = Top, const QMargins& margins = QMargins(16, 16, 16, 16))Shows a managed toast or updates the open toast with the same key.
Signals
void actionChanged(QAction* action)Optional caller-owned action presented inside the toast.
void closableChanged(bool closable)Whether a close button dismisses the toast with `CloseButton`.
void pauseOnHoverEnabledChanged(bool enabled)Whether an active duration timer pauses while the toast is hovered.
void updateKeyChanged(const QString& key)Optional key used by `showOrUpdateToast()` within one managed stack.
Enumerations
enum SeverityInformationalSuccessWarningError
enum PlacementEdge anchor for the toast card.
TopStartTopTopEndBottomStartBottomBottomEnd
enum DismissReasonReason that ended one toast presentation lifetime.
ProgrammaticTimedOutActionInvokedEvictedCloseButton
Destructors
Subclass interfaces
Methods
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:QWidget