-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtipbox.h
61 lines (49 loc) · 1.25 KB
/
tipbox.h
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
55
56
57
58
59
60
61
#ifndef TIPBOXWIDGET_H
#define TIPBOXWIDGET_H
#include <QObject>
#include <QWidget>
#include <QList>
#include <QTimer>
#include <QDebug>
#include <QPaintEvent>
#include <QPainter>
#include <QPainterPath>
#include <QPropertyAnimation>
#include "tipcard.h"
#define CARDS_INTERVAL 0
#define MARGIN_PARENT_RIGHT 20
#define MARGIN_PARENT_BOTTOM 10
#define CARD_FIXED_WIDTH 200
class TipBox : public QWidget
{
Q_OBJECT
public:
explicit TipBox(QWidget *parent);
TipCard* createTipCard(NotificationEntry *noti);
void setBgColor(QColor c);
void setFontColor(QColor c);
void setBtnColor(QColor c);
protected:
void enterEvent(QEvent *event) override;
void leaveEvent(QEvent *event) override;
// void paintEvent(QPaintEvent *event) override;
private:
void addCard(TipCard *card);
signals:
void signalCardClosed(NotificationEntry* noti);
void signalCardClicked(NotificationEntry* noti);
void signalBtnClicked(NotificationEntry* noti);
public slots:
void slotCardClosed(TipCard* card);
void adjustPosition();
private:
QList<TipCard*> cards;
int sum_height;
bool hovering;
int suitable_width;
// 保存色彩值
QColor bg_color;
QColor font_color;
QColor btn_color;
};
#endif // TIPBOXWIDGET_H