forked from RealChuan/Qt-Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbubblewidget.h
52 lines (36 loc) · 1 KB
/
bubblewidget.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
#ifndef BUBBLEWIDGET_H
#define BUBBLEWIDGET_H
#include <QWidget>
class BubbleWidget : public QWidget
{
Q_OBJECT
public:
enum Direction{ Left, Right, Top, Bottom };
explicit BubbleWidget(QWidget *parent = nullptr);
~BubbleWidget() override;
void setPen(const QPen &pen);
QPen pen() const;
void setBrush(const QBrush &brush);
QBrush brush() const;
void setShadowWidth(qint64 width);
qint64 shadowWidth();
void setBorderRadius(qint64 radius);
qint64 borderRadius();
void setText(const QString &text);
QString text() const;
// 设置小三角宽和高;
void setTriangleInfo(int width, int height);
void setDerection(Direction);
Direction direction();
void exec();
signals:
void aboutToClose();
protected:
void paintEvent(QPaintEvent *) override;
void closeEvent(QCloseEvent *event) override;
private:
void setupUI();
class BubbleWidgetPrivate;
QScopedPointer<BubbleWidgetPrivate> d_ptr;
};
#endif // BUBBLEWIDGET_H