forked from ic005k/OCAuxiliaryTools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBalloonTip.h
44 lines (37 loc) · 1.14 KB
/
BalloonTip.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
#ifndef BALLOONTIP_H
#define BALLOONTIP_H
#include <QMessageBox>
#include <QPixmap>
#include <QTimer>
#include <QTimerEvent>
#include <QWidget>
class BalloonTip : public QWidget {
Q_OBJECT
public:
QTimer* timer;
static void showBalloon(QMessageBox::Icon icon, const QString& title,
const QString& msg, const QPoint& pos, int timeout,
bool showArrow = true, int arrowDir = 12);
static void hideBalloon();
static bool isBalloonVisible();
static void updateBalloonPosition(const QPoint& pos);
private:
BalloonTip(QMessageBox::Icon icon, const QString& title, const QString& msg);
~BalloonTip();
void balloon(const QPoint&, int, bool, int arrowDir);
protected:
void paintEvent(QPaintEvent*) Q_DECL_OVERRIDE;
void resizeEvent(QResizeEvent*) Q_DECL_OVERRIDE;
void mousePressEvent(QMouseEvent* e) Q_DECL_OVERRIDE;
void timerEvent(QTimerEvent* e) Q_DECL_OVERRIDE;
private slots:
void closeTip();
private:
QPixmap pixmap;
int timerId;
int eventTimerId;
bool showArrow;
bool enablePressEvent;
int arrowDir;
};
#endif // BALLOONTIP_H