Fluent-Qt

Status & info

SplashScreen

Cover a content area during startup, report progress, and dismiss when ready.

Example

SplashScreen: Application startup

Usage

Application startup

Branded is the default light reveal. Select Simple for the centered loading ring, or replay the transition.

#include <FluentQt/StatusInfo.h>
using namespace fluent::status_info;

auto* root = new QWidget(this);
auto* layout = new QVBoxLayout(root);
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(12);
const QIcon appIcon(":/app/assets/app-icon.png");
auto* host = new fluent::layout::Card(root);
host->setObjectName("splashPreviewHost");
host->setAppearance(fluent::layout::Card::Canvas);
host->setBorderVisible(false);
host->setFixedHeight(400);
auto* contentLayout = new QVBoxLayout(host);
contentLayout->setContentsMargins(24, 24, 24, 24);
auto* header = new QHBoxLayout;
auto* logo = new Label(host);
logo->setObjectName("splashDestinationIcon");
logo->setFixedSize(28, 28);
header->addWidget(logo);
header->addWidget(new Label("FluentQt Gallery", host));
contentLayout->addLayout(header);
contentLayout->addStretch();
auto* splash = new SplashScreen(host);
splash->setObjectName("sampleSplash");
splash->setIcon(appIcon);
splash->setTitle("FluentQt");
splash->setSubtitle("Small details. Fluent experiences.");
splash->setText("Starting FluentQt Gallery");
splash->setTransitionTarget(logo);
QObject::connect(splash, &SplashScreen::dismissed, logo,
                 [logo, appIcon]() { logo->setPixmap(appIcon.pixmap(28, 28)); });
splash->show();
// Demo timing only; applications report actual work and call dismiss when ready.
auto* loading = new QVariantAnimation(splash);
loading->setObjectName("sampleSplashLoading");
loading->setDuration(3600);
loading->setStartValue(0);
loading->setEndValue(120);
QObject::connect(loading, &QVariantAnimation::valueChanged, splash, [splash](const QVariant& value) {
    const int step = value.toInt();
    splash->setProgress(qMax(0, step - 20), 100);
    splash->setIndeterminate(step < 20);
    splash->setText(step < 100 ? "Loading resources" : "Opening Gallery");
});
QObject::connect(loading, &QVariantAnimation::finished, splash, &SplashScreen::dismiss);
auto restart = [splash, loading, logo]() {
    loading->stop();
    splash->hide();
    logo->clear();
    splash->setIndeterminate(true);
    splash->show();
    loading->start();
};
auto* presentation = new fluent::basicinput::ComboBox(root);
presentation->setObjectName("splashPresentation");
presentation->setAccessibleName("Splash presentation");
presentation->addItems({"Branded", "Simple"});
QObject::connect(presentation, QOverload<int>::of(&QComboBox::currentIndexChanged), splash,
    [splash, restart](int index) {
        splash->setPresentation(index == 0 ? SplashScreen::Presentation::Branded
                                           : SplashScreen::Presentation::Simple);
        restart();
    });
auto* replay = new Button("Replay startup", root);
replay->setObjectName("replaySplashButton");
replay->setFluentStyle(Button::ButtonStyle::Accent);
QObject::connect(replay, &Button::clicked, splash, restart);
auto* controls = new QHBoxLayout;
controls->addWidget(presentation);
controls->addStretch();
controls->addWidget(replay);
layout->addWidget(host);
layout->addLayout(controls);

fluent::status_info::SplashScreen

Inherits QWidget · FluentElement · QMLPlus

Reusable startup surface covering its parent widget's content area.

Constructors

Properties

Presentation presentation
Read presentation()Write setPresentation()Notify presentationChanged()
QIcon icon
Read icon()Write setIcon()Notify iconChanged()
QSize iconSize
Read iconSize()Write setIconSize()Notify iconSizeChanged()
QString text
Read text()Write setText()Notify textChanged()
QString title
Read title()Write setTitle()Notify titleChanged()
QString subtitle
Read subtitle()Write setSubtitle()Notify subtitleChanged()
QWidget* transitionTarget
Read transitionTarget()Write setTransitionTarget()Notify transitionTargetChanged()
int progress
Read progress()Notify progressChanged()
bool indeterminate
Read isIndeterminate()Write setIndeterminate()Notify indeterminateChanged()

Methods

void setPresentation(Presentation presentation)

Selects the startup presentation without changing progress or ownership.

void setIconSize(const QSize& size)

Sets the preferred artwork size; each dimension is at least one logical pixel.

void setText(const QString& text)

Sets plain status text; long text is elided visually but remains accessible.

void setTitle(const QString& title)

Sets the optional plain-text brand title shown in Branded presentation.

void setSubtitle(const QString& subtitle)

Sets the optional plain-text subtitle shown below the brand title.

void setTransitionTarget(QWidget* target)

Borrows an icon holder as the destination of the Branded dismissal.

void setProgress(int done, int total)

Sets clamped determinate progress; total <= 0 selects indeterminate mode.

void dismiss()

Dismisses, hides and emits dismissed once; repeated or hidden calls do nothing.

Signals

void replaced()

Emitted after another cover hides this one on an overlapping host.

Enumerations

enum class Presentation

Branded is the default light reveal; Simple retains the centered loading ring.

  • Branded
  • Simple

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