12class QML_MATERIAL_API
RippleMotion :
public QObject,
public QQmlParserStatus {
15 Q_INTERFACES(QQmlParserStatus)
16 Q_PROPERTY(InteractionSource* interactionSource READ interactionSource WRITE
17 setInteractionSource NOTIFY inputChanged FINAL)
18 Q_PROPERTY(qml_material::IndicationValues indication READ indication WRITE setIndication RESET
19 resetIndication NOTIFY inputChanged FINAL)
20 Q_PROPERTY(QQuickItem* target READ target WRITE setTarget NOTIFY inputChanged FINAL)
21 Q_PROPERTY(
bool enabled READ isEnabled WRITE setEnabled NOTIFY inputChanged FINAL)
22 Q_PROPERTY(qreal stateOpacity READ stateOpacity WRITE setStateOpacity NOTIFY inputChanged FINAL)
23 Q_PROPERTY(qreal pressOpacity READ pressOpacity WRITE setPressOpacity NOTIFY inputChanged FINAL)
24 Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY inputChanged FINAL)
25 Q_PROPERTY(qreal opacity READ opacity NOTIFY valueChanged FINAL)
26 Q_PROPERTY(qreal rippleOpacity READ rippleOpacity NOTIFY valueChanged FINAL)
27 Q_PROPERTY(qreal progress READ progress NOTIFY valueChanged FINAL)
28 Q_PROPERTY(qreal phase READ phase NOTIFY valueChanged FINAL)
29 Q_PROPERTY(QPointF origin READ origin NOTIFY valueChanged FINAL)
30 Q_PROPERTY(QColor ink READ ink NOTIFY valueChanged FINAL)
31 Q_PROPERTY(
bool running READ running NOTIFY runningChanged FINAL)
35 void classBegin()
override { m_complete =
false; }
36 void componentComplete()
override;
37 InteractionSource* interactionSource()
const {
return m_source; }
38 void setInteractionSource(InteractionSource*);
39 IndicationValues indication()
const;
40 void setIndication(
const IndicationValues&);
41 void resetIndication();
42 QQuickItem* target()
const {
return m_target; }
43 void setTarget(QQuickItem*);
44 bool isEnabled()
const {
return m_enabled; }
45 void setEnabled(
bool);
46 qreal stateOpacity()
const {
return m_stateOpacity; }
47 void setStateOpacity(qreal);
48 qreal pressOpacity()
const {
return m_pressOpacity; }
49 void setPressOpacity(qreal);
50 QColor color()
const {
return m_color; }
51 void setColor(
const QColor&);
52 qreal opacity()
const {
return m_opacity; }
53 qreal rippleOpacity()
const {
return m_rippleOpacity; }
54 qreal progress()
const {
return m_progress; }
55 qreal phase()
const {
return m_phase; }
56 QPointF origin()
const {
return m_origin; }
57 QColor ink()
const {
return m_ink; }
58 bool running()
const {
return m_running; }
59 Q_SIGNAL
void inputChanged();
60 Q_SIGNAL
void valueChanged();
61 Q_SIGNAL
void runningChanged();
64 friend class RippleClock;
65 void updateTarget(
bool snap =
false);
66 void startPress(quint64,
const QPointF&);
67 void endPress(quint64, Interaction::Phase);
73 QPointer<InteractionSource> m_source;
74 std::optional<IndicationValues> m_indication;
75 QPointer<QQuickItem> m_target;
76 QList<QMetaObject::Connection> m_sourceConnections;
77 std::unique_ptr<ItemActivity> m_activity;
78 std::unique_ptr<RippleClock> m_clock;
79 QMetaObject::Connection m_targetDestroyed;
80 bool m_hasTarget =
false;
81 bool m_enabled =
true, m_complete =
true, m_running =
false;
82 bool m_wave =
false, m_releasing =
false;
83 quint64 m_pressId = 0, m_revision = 0;
84 int m_kind = Interaction::None, m_stateStart = 0, m_stateDuration = 0;
85 int m_pressStart = 0, m_releaseStart = 0;
87 qreal m_opacity = 0, m_fromOpacity = 0, m_toOpacity = 0;
88 qreal m_progress = 0, m_phase = 0, m_rippleOpacity = 0, m_releaseFrom = 0, m_waveAlpha = 0;
90 QColor m_color { Qt::transparent }, m_ink { Qt::transparent };
91 IndicationPolicy m_defaultIndication;