7#include <Kanoop/timespan.h>
8#include <Kanoop/gui/libkanoopgui.h>
10class QGraphicsOpacityEffect;
38 void message(
const QString& text) { displayToast(text, _messageBackgroundColor, _messageForegroundColor); }
44 void errorMessage(
const QString& text) { displayToast(text, _errorBackgroundColor, _errorForegroundColor); }
52 void displayToast(
const QString& text,
const QColor& backgroundColor,
const QColor& foregroundColor);
70 TimeSpan
fadeTime()
const {
return _fadeTime; }
130 QSize
size()
const {
return _size; }
136 void resize(
const QSize& value) { _size = value; }
142 QPoint
pos()
const {
return _pos; }
148 void move(
const QPoint& value) { _pos = value; }
151 void performLayout();
152 virtual bool eventFilter(QObject *watched, QEvent *event)
override;
154 QWidget* _parentWidget;
155 TimeSpan _beginFadeTime;
160 QColor _messageBackgroundColor;
161 QColor _messageForegroundColor;
162 QColor _errorBackgroundColor;
163 QColor _errorForegroundColor;
165 QList<ToastWidget*> _toasts;
QLabel subclass with font size and color Q_PROPERTYs.
Non-modal toast notification manager overlaid on a parent widget.
void move(const QPoint &value)
Set the position of toasts within the parent widget.
void setFadeTime(TimeSpan value)
Set the duration of the fade-out animation.
void resize(const QSize &value)
Set the fixed size of toast widgets.
void setBeginFadeTime(const TimeSpan &value)
Set the time after which the toast begins fading.
void displayToast(const QString &text, const QColor &backgroundColor, const QColor &foregroundColor)
Display a toast with explicit colors.
ToastManager(QWidget *parent)
Construct attached to a parent widget.
QPoint pos() const
Return the position of toasts within the parent widget.
QColor errorBackgroundColor() const
Return the background color for error messages.
QColor messageForegroundColor() const
Return the foreground color for normal messages.
TimeSpan beginFadeTime() const
Return the time after which the toast begins fading.
void setMessageForegroundColor(const QColor &value)
Set the foreground color for normal messages.
TimeSpan fadeTime() const
Return the duration of the fade-out animation.
void message(const QString &text)
Display a normal-priority message toast.
QSize size() const
Return the fixed size of toast widgets.
void errorMessage(const QString &text)
Display an error-priority message toast.
void setMessageBackgroundColor(const QColor &value)
Set the background color for normal messages.
void setErrorForegroundColor(const QColor &value)
Set the foreground color for error messages.
QColor messageBackgroundColor() const
Return the background color for normal messages.
void setErrorBackgroundColor(const QColor &value)
Set the background color for error messages.
QColor errorForegroundColor() const
Return the foreground color for error messages.