CCIMXDesktop
 
Loading...
Searching...
No Matches
desktoptoast.h
1#ifndef DESKTOPTOAST_H
2#define DESKTOPTOAST_H
3#include <QMutex>
4#include <QPointer>
5#include <QQueue>
6#include <QWidget>
7class QLabel;
8class QPropertyAnimation;
9
15class DesktopToast : public QWidget {
16 Q_OBJECT
17public:
23 explicit DesktopToast(QWidget* parent = nullptr);
32 void set_message(const QString& message);
33signals:
40 void do_show_toast(QString msg);
41
42private:
47 void adjust_place();
51 void start_animation();
55 void start_close_animation();
60 void set_message_impl(const QString& message);
61
62 QLabel* label;
63 QPoint startPos, endPos;
64 int animation_maintain_msec { 500 };
65 int wait_time { 1000 };
73 QPointer<QPropertyAnimation> moveAnimation { nullptr };
81 QPointer<QPropertyAnimation> fadeAnimation { nullptr };
82
87 QAtomicInteger<bool> isHandling { false };
96 QQueue<QString> pools;
97 QMutex queue_mutex;
98};
99
100#endif // DESKTOPTOAST_H
The DesktopToast class is the toast handle classes using less lock messages queue to display the mess...
Definition DesktopToast.h:15
DesktopToast(QWidget *parent=nullptr)
Construct a new Desktop Toast object.
void do_show_toast(QString msg)
do_show_toast the signal to show the toast
void set_message(const QString &message)
set_message push the toast display into the toast display sessions