-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathNotification.h
More file actions
54 lines (43 loc) · 1.55 KB
/
Copy pathNotification.h
File metadata and controls
54 lines (43 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#pragma once
#include <QWidget>
#include <QStaticText>
#include <QPropertyAnimation>
#include <QQueue>
#include <QTimer>
class QLabel;
class Notification : public QWidget
{
Q_OBJECT
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity)
public:
explicit Notification(const QString& text, QWidget* parent = nullptr);
explicit Notification(const QString& text, const QFont& font, int milliseconds, QWidget* parent = nullptr);
virtual ~Notification();
public:
void setTextColor(QColor& color) { m_textColor = color; }
void showImmediatly();
void run();
void fadeOut();
void setOpacity(qreal opacity);
qreal opacity() const;
public:
static void showMessage(const QString& message, QWidget* parent=nullptr);
static void showMessage(const QString& message, QString& url, QRect rect, int milliseconds, QWidget* parent);
static void showMessage(const QString& message, const QFont& font, QWidget* parent);
static void showMessage(const QString& message, const QFont& font, int milliseconds, QWidget* parent);
static void showMessage(const QString& message, QColor color, QRect rect, int milliseconds, QWidget* parent);
static void append(Notification*);
protected:
void paintEvent(QPaintEvent* event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
protected:
static QQueue<Notification*> queue;
static bool underProcessing;
private:
QStaticText m_label;
qreal m_opacity;
int m_milliseconds;
QString m_url;
QPropertyAnimation* m_animation;
QColor m_textColor;
};