Maki
Formally verfied low-code orchestration
Loading...
Searching...
No Matches
NotificationWidget Class Reference

A transient UI widget for displaying notifications with animation and auto-dismiss support. More...

#include <notification_widget.h>

Inheritance diagram for NotificationWidget:
StyledFrame maki::LongNotificationWidget

Public Slots

void showAnimated ()
 Shows the notification with a fade-in animation.
void hideAnimated ()
 Hides the notification with a fade-out animation.

Signals

void dismissed (NotificationWidget *self)
 Emitted when the notification is dismissed.

Public Member Functions

 NotificationWidget (const QString &title, const QString &text, logging::LogLevel level, QWidget *parent=nullptr)
 Constructs a notification widget.
qreal opacity () const
 Returns the current opacity of the widget.
void setOpacity (qreal o)
 Sets the opacity of the widget.
Public Member Functions inherited from StyledFrame
 StyledFrame (QWidget *parent=nullptr)
 Constructs a StyledFrame with the given parent.
void setBackgroundRole (BackgroundRole role)
 Sets the background role of the frame.
void setBorderRole (BorderRole role)
 Sets the border role of the frame.
void setCustomBackgroundColor (const QColor &color)
 Sets a custom background color for the frame.
void setCustomBorderColor (const QColor &color)
 Sets a custom border color for the frame.
void setBorderWidth (int width)
 Sets the width of the border.
void setRadius (qreal radius)
 Sets the radius for rounded corners.

Protected Attributes

QTimer mAutoCloseTimer
 Timer used to automatically dismiss the notification.
QPropertyAnimation * mFadeAnim
 Animation used to control opacity transitions.

Properties

qreal opacity
 Controls the visual opacity of the widget.

Private Attributes

ClickableIcon * mMinimizeButton
 Button used to manually minimize the notification.
ClickableIcon * mCloseButton
 Button used to manually dismiss the notification.
bool mMinimized
 Whether the widget is expanded or minimized.
qreal mOpacity
 Current opacity value of the widget.

Additional Inherited Members

Protected Member Functions inherited from StyledFrame
void paintEvent (QPaintEvent *event) override
 Handles the paint event to draw the styled frame.

Detailed Description

A transient UI widget for displaying notifications with animation and auto-dismiss support.

This widget displays a message with a title and severity level, and supports:

  • Fade-in and fade-out animations
  • Automatic dismissal via timer
  • Manual dismissal via a close button

The widget exposes an opacity property used for animation.

Constructor & Destructor Documentation

◆ NotificationWidget()

NotificationWidget::NotificationWidget ( const QString & title,
const QString & text,
logging::LogLevel level,
QWidget * parent = nullptr )

Constructs a notification widget.

Parameters
titleThe title of the notification.
textThe main message text.
levelThe log level determining the visual style (e.g., info, warning, error).
parentThe parent widget.

Member Function Documentation

◆ dismissed

void NotificationWidget::dismissed ( NotificationWidget * self)
signal

Emitted when the notification is dismissed.

Parameters
selfPointer to this notification widget.

◆ opacity()

qreal NotificationWidget::opacity ( ) const

Returns the current opacity of the widget.

Returns
The opacity value in the range [0.0, 1.0].

◆ setOpacity()

void NotificationWidget::setOpacity ( qreal o)

Sets the opacity of the widget.

Parameters
oThe opacity value to set (typically between 0.0 and 1.0).

Property Documentation

◆ opacity

qreal NotificationWidget::opacity
readwrite

Controls the visual opacity of the widget.

This property is typically animated using QPropertyAnimation to create fade-in and fade-out effects.


The documentation for this class was generated from the following files: