blob: 9ef91fbf2ade58c267b1bdd4b30f3ab359f77c36 (
plain) (
blame)
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
|
#pragma once
#include <QPainterPath>
#include "OverlayWidget.h"
class Ripple;
class RippleOverlay : public OverlayWidget
{
Q_OBJECT
public:
explicit RippleOverlay(QWidget *parent = 0);
void addRipple(Ripple *ripple);
void addRipple(const QPoint &position, qreal radius = 300);
void removeRipple(Ripple *ripple);
inline void setClipping(bool enable);
inline bool hasClipping() const;
inline void setClipPath(const QPainterPath &path);
protected:
void paintEvent(QPaintEvent *event) Q_DECL_OVERRIDE;
private:
Q_DISABLE_COPY(RippleOverlay)
void paintRipple(QPainter *painter, Ripple *ripple);
QList<Ripple *> ripples_;
QPainterPath clip_path_;
bool use_clip_;
};
inline void
RippleOverlay::setClipping(bool enable)
{
use_clip_ = enable;
update();
}
inline bool
RippleOverlay::hasClipping() const
{
return use_clip_;
}
inline void
RippleOverlay::setClipPath(const QPainterPath &path)
{
clip_path_ = path;
update();
}
|