Notifications

This document describes the two supported ways to send notifications in the plugin system: a global notification API and a plugin-scoped convenience wrapper.

Notifications in action
Notifications are stacked on top of each other, and disappear automatically.


Global notification

mv::help().addNotification(
    const QString& title,
    const QString& description,
    const StyledIcon& icon,
    util::Notification::DurationType durationType,
    std::int32_t delayMs
);

Adds a notification to the main application window.

This function is intended for global notifications, independent of any plugin context.

Parameters

  • title
    Short notification title displayed prominently.

  • description
    Detailed notification text. May contain HTML.

  • icon
    Icon displayed alongside the notification (for example, "circle-exclamation").

  • durationType
    Controls how long the notification remains visible:

    • Fixed — fixed duration

    • Calculated — duration based on content length

    • Task — remains visible until the associated task completes

  • delayMs
    Delay in milliseconds before the notification is shown.

Example

mv::help().addNotification(
    "Download problem",
    QStringLiteral("Project not downloaded: %1").arg(errorString),
    StyledIcon("circle-exclamation"),
    util::Notification::DurationType::Fixed,
    0
);

Foreground task notifications

Tasks that run with Foreground GUI scope are presented to the user as temporary notifications.

While the task is running:

  • A notification is shown automatically.

  • The notification includes a progress indicator.

  • No user interaction is required.

When the task finishes:

  • The notification is dismissed automatically.

  • The user does not need to manually close or acknowledge it.

Example

auto foregroundTask = new mv::ForegroundTask(this, "My foreground task");
foregroundTask->setRunning();

Creating a ForegroundTask and marking it as running will display a transient notification with a progress bar for the duration of the task. Once the task completes, the notification disappears automatically.