Notification
Qualified name: mv::util::Notification
-
class Notification : public QWidget
Notification widget class.
For showing stacked notifications in a toaster-like way (see the notifications class).
Note: This class is developed for internal use only
- Author
Thomas Kroes
Public Types
-
enum class DurationType
Duration types.
Values:
-
enumerator Fixed
-
enumerator Calculated
Standard 5000 ms.
-
enumerator Task
Calculated based on the number of characters.
Notification is visible as long as the task is running
-
enumerator Fixed
Public Functions
-
explicit Notification(const QString &title, const QString &description, const QIcon &icon, Notification *previousNotification, const DurationType &durationType, QWidget *parent = nullptr)
Construct a notification with
title,description,icon,previousNotificationand pointer toparentwidget.- Parameters:
title – Notification title
description – Notification description
icon – Notification icon
previousNotification – Pointer to previous notification (maybe nullptr)
durationType – Duration type of the notification
parent – Pointer to parent widget
-
explicit Notification(QPointer<Task> task, Notification *previousNotification, QWidget *parent = nullptr)
Construct a notification with
task,previousNotificationand pointer toparentwidget.- Parameters:
task – Task containing the notification details
previousNotification – Pointer to previous notification (maybe nullptr)
parent – Pointer to parent widget
-
bool isClosing() const
Get whether the notification is closing.
- Returns:
Boolean determining Whether the notification is closing or not
-
Notification *getPreviousNotification() const
Get previous notification.
- Returns:
Pointer to previous notification (maybe nullptr)
-
void setPreviousNotification(Notification *previousNotification)
Set previous notification to
previousNotification.- Parameters:
previousNotification – Pointer to previous notification (maybe nullptr)
-
Notification *getNextNotification() const
Get next notification.
- Returns:
Pointer to next notification (maybe nullptr)
-
void setNextNotification(Notification *nextNotification)
Set next notification to
nextNotification.- Parameters:
nextNotification – Pointer to next notification (maybe nullptr)
-
QIcon getIcon() const
Get the notification icon.
- Returns:
Notification icon
-
void setIcon(const QIcon &icon)
Set the notification icon to
iconand update the icon label.- Parameters:
icon – Notification icon
-
QString getTitle() const
Get the notification title.
- Returns:
Notification title
-
void setTitle(const QString &title)
Set the notification title to
titleand update the message text label.- Parameters:
title – Notification title
-
QString getDescription() const
Get the notification description.
- Returns:
Notification description
-
void setDescription(const QString &description)
Set the notification description to
descriptionand update the message text label.- Parameters:
description – Notification description
-
QSize minimumSizeHint() const override
Returns the preferred minimum size (overriden to allow for less tall notification widget)
- Returns:
Minimum size hint
-
QSize sizeHint() const override
Returns the preferred minimum size (overriden to allow for less tall notification widget)
- Returns:
Minimum size hint
-
void finished()
Signal emitted when the toaster finishes displaying.