-
Notifications
You must be signed in to change notification settings - Fork 712
/
Copy pathqtmaterialrippleoverlay.h
64 lines (46 loc) · 1.42 KB
/
qtmaterialrippleoverlay.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
62
63
64
#ifndef QTMATERIALRIPPLEOVERLAY_H
#define QTMATERIALRIPPLEOVERLAY_H
#include <QPainterPath>
#include "lib/qtmaterialoverlaywidget.h"
class QtMaterialRipple;
class QtMaterialRippleOverlay : public QtMaterialOverlayWidget
{
Q_OBJECT
public:
explicit QtMaterialRippleOverlay(QWidget *parent = 0);
~QtMaterialRippleOverlay();
void addRipple(QtMaterialRipple *ripple);
void addRipple(const QPoint &position, qreal radius = 300);
void removeRipple(QtMaterialRipple *ripple);
inline void setClipping(bool enable);
inline bool hasClipping() const;
inline void setClipPath(const QPainterPath &path);
protected:
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
inline QList<QtMaterialRipple *> ripples() const;
private:
Q_DISABLE_COPY(QtMaterialRippleOverlay)
void paintRipple(QPainter *painter, QtMaterialRipple *ripple);
QList<QtMaterialRipple *> m_ripples;
QPainterPath m_clipPath;
bool m_useClip;
};
inline void QtMaterialRippleOverlay::setClipping(bool enable)
{
m_useClip = enable;
update();
}
inline bool QtMaterialRippleOverlay::hasClipping() const
{
return m_useClip;
}
inline void QtMaterialRippleOverlay::setClipPath(const QPainterPath &path)
{
m_clipPath = path;
update();
}
inline QList<QtMaterialRipple *> QtMaterialRippleOverlay::ripples() const
{
return m_ripples;
}
#endif // QTMATERIALRIPPLEOVERLAY_H