Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qquickmaterialripple_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QQUICKMATERIALRIPPLE_P_H
6#define QQUICKMATERIALRIPPLE_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtQuick/qquickitem.h>
20#include <QtGui/qcolor.h>
21#include <QtCore/private/qglobal_p.h>
22
23QT_BEGIN_NAMESPACE
24
25class QQuickMaterialRipple : public QQuickItem
26{
27 Q_OBJECT
28 Q_PROPERTY(QColor color READ color WRITE setColor FINAL)
29 Q_PROPERTY(qreal clipRadius READ clipRadius WRITE setClipRadius FINAL)
30 Q_PROPERTY(bool pressed READ isPressed WRITE setPressed FINAL)
31 Q_PROPERTY(bool active READ isActive WRITE setActive FINAL)
32 Q_PROPERTY(QQuickItem *anchor READ anchor WRITE setAnchor FINAL)
33 Q_PROPERTY(Trigger trigger READ trigger WRITE setTrigger FINAL)
34 QML_NAMED_ELEMENT(Ripple)
35 QML_ADDED_IN_VERSION(2, 0)
36
37public:
38 QQuickMaterialRipple(QQuickItem *parent = nullptr);
39
40 QColor color() const;
41 void setColor(const QColor &color);
42
43 qreal clipRadius() const;
44 void setClipRadius(qreal radius);
45
46 bool isActive() const;
47 void setActive(bool active);
48
49 bool isPressed() const;
50 void setPressed(bool pressed);
51
52 enum Trigger { Press, Release };
53 Q_ENUM (Trigger)
54
55 Trigger trigger() const;
56 void setTrigger(Trigger trigger);
57
58 QPointF anchorPoint() const;
59
60 QQuickItem *anchor() const;
61 void setAnchor(QQuickItem *anchor);
62
63 qreal diameter() const;
64
65protected:
66 void itemChange(ItemChange change, const ItemChangeData &data) override;
67 QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *) override;
68 void timerEvent(QTimerEvent *event) override;
69
70 void prepareWave();
71 void enterWave();
72 void exitWave();
73
74private:
75 bool m_active = false;
76 bool m_pressed = false;
77 int m_waves = 0;
78 int m_enterDelay = 0;
79 Trigger m_trigger = Press;
80 qreal m_clipRadius = 0.0;
81 QColor m_color;
82 QQuickItem *m_anchor = nullptr;
83};
84
86
87#endif // QQUICKMATERIALRIPPLE_P_H
void sync(QQuickItem *item) override
void updateCurrentTime(int time) override
void sync(QQuickItem *item) override
QQuickMaterialRippleWaveNode(QQuickMaterialRipple *ripple)
static const int WAVE_OPACITY_DECAY_DURATION
static const int RIPPLE_ENTER_DELAY
static const int OPACITY_ENTER_DURATION_FAST
static const qreal WAVE_TOUCH_DOWN_ACCELERATION