ui/widget/material/base/ripple_helper.h¶
Material Design ripple effect helper. More...
Namespaces¶
| Name |
|---|
| cf |
| cf::ui |
| cf::ui::widget |
| cf::ui::widget::material |
| cf::ui::widget::material::base |
Classes¶
| Name | |
|---|---|
| struct | cf::ui::widget::material::base::MdRipple Material Design ripple data structure. |
| class | cf::ui::widget::material::base::RippleHelper Material Design ripple effect helper. |
Detailed Description¶
Material Design ripple effect helper.
Author: N/A
Version: N/A
Since: N/A
Date: N/A
Manages ripple effects for Material Design widgets. Provides animated ripple propagation on press/release interactions with bounded and unbounded modes.
Source code¶
#pragma once
#include "color.h"
#include "components/material/cfmaterial_animation_factory.h"
#include <QObject>
#include <QPointF>
class QPainterPath;
namespace cf::ui::widget::material::base {
struct MdRipple {
QPointF center;
float radius;
float opacity;
bool releasing;
float maxRadius;
};
class CF_UI_EXPORT RippleHelper : public QObject {
Q_OBJECT
public:
explicit RippleHelper(cf::WeakPtr<components::material::CFMaterialAnimationFactory> factory,
QObject* parent);
enum class Mode {
Bounded,
Unbounded
};
Q_ENUM(Mode)
void setMode(Mode mode);
void setColor(const cf::ui::base::CFColor& color);
void onPress(const QPoint& pos, const QRectF& widgetRect);
void onRelease();
void onCancel();
void paint(QPainter* painter, const QPainterPath& clipPath);
bool hasActiveRipple() const;
signals:
void repaintNeeded();
private:
QList<MdRipple> m_ripples;
Mode m_mode = Mode::Bounded;
cf::ui::base::CFColor m_color;
cf::WeakPtr<components::material::CFMaterialAnimationFactory> m_animator;
float maxRadius(const QRectF& rect, const QPointF& center) const;
};
} // namespace cf::ui::widget::material::base
Updated on 2026-03-09 at 10:14:01 +0000