KanoopGuiQt 1.3.0
Qt GUI utility library
Loading...
Searching...
No Matches
ToastManager Class Reference

Non-modal toast notification manager overlaid on a parent widget. More...

#include <toastmanager.h>

+ Inheritance diagram for ToastManager:
+ Collaboration diagram for ToastManager:

Public Member Functions

 ToastManager (QWidget *parent)
 Construct attached to a parent widget.
 
void message (const QString &text)
 Display a normal-priority message toast.
 
void errorMessage (const QString &text)
 Display an error-priority message toast.
 
void displayToast (const QString &text, const QColor &backgroundColor, const QColor &foregroundColor)
 Display a toast with explicit colors.
 
TimeSpan beginFadeTime () const
 Return the time after which the toast begins fading.
 
void setBeginFadeTime (const TimeSpan &value)
 Set the time after which the toast begins fading.
 
TimeSpan fadeTime () const
 Return the duration of the fade-out animation.
 
void setFadeTime (TimeSpan value)
 Set the duration of the fade-out animation.
 
QColor messageForegroundColor () const
 Return the foreground color for normal messages.
 
void setMessageForegroundColor (const QColor &value)
 Set the foreground color for normal messages.
 
QColor messageBackgroundColor () const
 Return the background color for normal messages.
 
void setMessageBackgroundColor (const QColor &value)
 Set the background color for normal messages.
 
QColor errorForegroundColor () const
 Return the foreground color for error messages.
 
void setErrorForegroundColor (const QColor &value)
 Set the foreground color for error messages.
 
QColor errorBackgroundColor () const
 Return the background color for error messages.
 
void setErrorBackgroundColor (const QColor &value)
 Set the background color for error messages.
 
QSize size () const
 Return the fixed size of toast widgets.
 
void resize (const QSize &value)
 Set the fixed size of toast widgets.
 
QPoint pos () const
 Return the position of toasts within the parent widget.
 
void move (const QPoint &value)
 Set the position of toasts within the parent widget.
 

Detailed Description

Non-modal toast notification manager overlaid on a parent widget.

ToastManager creates ToastWidget pop-ups positioned over the parent widget and fades them out after a configurable delay. Separate foreground/background colors can be set for normal messages and error messages. The toast size and position within the parent are also configurable.

Definition at line 24 of file toastmanager.h.

Constructor & Destructor Documentation

◆ ToastManager()

ToastManager::ToastManager ( QWidget *  parent)
explicit

Construct attached to a parent widget.

Parameters
parentWidget over which toasts are displayed

Member Function Documentation

◆ beginFadeTime()

TimeSpan ToastManager::beginFadeTime ( ) const
inline

Return the time after which the toast begins fading.

Returns
Begin-fade delay

Definition at line 58 of file toastmanager.h.

◆ displayToast()

void ToastManager::displayToast ( const QString &  text,
const QColor &  backgroundColor,
const QColor &  foregroundColor 
)

Display a toast with explicit colors.

Parameters
textMessage text to display
backgroundColorBackground color for the toast
foregroundColorForeground (text) color for the toast

◆ errorBackgroundColor()

QColor ToastManager::errorBackgroundColor ( ) const
inline

Return the background color for error messages.

Returns
Error message background color

Definition at line 118 of file toastmanager.h.

◆ errorForegroundColor()

QColor ToastManager::errorForegroundColor ( ) const
inline

Return the foreground color for error messages.

Returns
Error message foreground color

Definition at line 106 of file toastmanager.h.

◆ errorMessage()

void ToastManager::errorMessage ( const QString &  text)
inline

Display an error-priority message toast.

Parameters
textError message text to display

Definition at line 44 of file toastmanager.h.

◆ fadeTime()

TimeSpan ToastManager::fadeTime ( ) const
inline

Return the duration of the fade-out animation.

Returns
Fade duration

Definition at line 70 of file toastmanager.h.

◆ message()

void ToastManager::message ( const QString &  text)
inline

Display a normal-priority message toast.

Parameters
textMessage text to display

Definition at line 38 of file toastmanager.h.

◆ messageBackgroundColor()

QColor ToastManager::messageBackgroundColor ( ) const
inline

Return the background color for normal messages.

Returns
Normal message background color

Definition at line 94 of file toastmanager.h.

◆ messageForegroundColor()

QColor ToastManager::messageForegroundColor ( ) const
inline

Return the foreground color for normal messages.

Returns
Normal message foreground color

Definition at line 82 of file toastmanager.h.

◆ move()

void ToastManager::move ( const QPoint &  value)
inline

Set the position of toasts within the parent widget.

Parameters
valueNew toast position in parent coordinates

Definition at line 148 of file toastmanager.h.

◆ pos()

QPoint ToastManager::pos ( ) const
inline

Return the position of toasts within the parent widget.

Returns
Toast position in parent coordinates

Definition at line 142 of file toastmanager.h.

◆ resize()

void ToastManager::resize ( const QSize &  value)
inline

Set the fixed size of toast widgets.

Parameters
valueNew toast size

Definition at line 136 of file toastmanager.h.

◆ setBeginFadeTime()

void ToastManager::setBeginFadeTime ( const TimeSpan &  value)
inline

Set the time after which the toast begins fading.

Parameters
valueNew begin-fade delay

Definition at line 64 of file toastmanager.h.

◆ setErrorBackgroundColor()

void ToastManager::setErrorBackgroundColor ( const QColor &  value)
inline

Set the background color for error messages.

Parameters
valueNew background color

Definition at line 124 of file toastmanager.h.

◆ setErrorForegroundColor()

void ToastManager::setErrorForegroundColor ( const QColor &  value)
inline

Set the foreground color for error messages.

Parameters
valueNew foreground color

Definition at line 112 of file toastmanager.h.

◆ setFadeTime()

void ToastManager::setFadeTime ( TimeSpan  value)
inline

Set the duration of the fade-out animation.

Parameters
valueNew fade duration

Definition at line 76 of file toastmanager.h.

◆ setMessageBackgroundColor()

void ToastManager::setMessageBackgroundColor ( const QColor &  value)
inline

Set the background color for normal messages.

Parameters
valueNew background color

Definition at line 100 of file toastmanager.h.

◆ setMessageForegroundColor()

void ToastManager::setMessageForegroundColor ( const QColor &  value)
inline

Set the foreground color for normal messages.

Parameters
valueNew foreground color

Definition at line 88 of file toastmanager.h.

◆ size()

QSize ToastManager::size ( ) const
inline

Return the fixed size of toast widgets.

Returns
Toast size

Definition at line 130 of file toastmanager.h.


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