matrixion/include/ui/RippleOverlay.h

59 lines
967 B
C
Raw Normal View History

#pragma once
2017-04-06 02:06:42 +03:00
#include <QPainterPath>
#include "OverlayWidget.h"
class Ripple;
class RippleOverlay : public OverlayWidget
{
Q_OBJECT
public:
explicit RippleOverlay(QWidget *parent = 0);
~RippleOverlay();
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_;
};
2017-08-20 13:47:22 +03:00
inline void
RippleOverlay::setClipping(bool enable)
2017-04-06 02:06:42 +03:00
{
use_clip_ = enable;
update();
}
2017-08-20 13:47:22 +03:00
inline bool
RippleOverlay::hasClipping() const
2017-04-06 02:06:42 +03:00
{
return use_clip_;
}
2017-08-20 13:47:22 +03:00
inline void
RippleOverlay::setClipPath(const QPainterPath &path)
2017-04-06 02:06:42 +03:00
{
clip_path_ = path;
update();
}