| 1 | // Copyright (C) 2016 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 | |
| 4 | #ifndef QQuickANGLEDDIRECTION_H |
| 5 | #define QQuickANGLEDDIRECTION_H |
| 6 | |
| 7 | // |
| 8 | // W A R N I N G |
| 9 | // ------------- |
| 10 | // |
| 11 | // This file is not part of the Qt API. It exists purely as an |
| 12 | // implementation detail. This header file may change from version to |
| 13 | // version without notice, or even be removed. |
| 14 | // |
| 15 | // We mean it. |
| 16 | // |
| 17 | #include "qquickdirection_p.h" |
| 18 | #include <QtQuickParticles/qtquickparticlesexports.h> |
| 19 | #include <QtQml/qqml.h> |
| 20 | |
| 21 | QT_BEGIN_NAMESPACE |
| 22 | |
| 23 | class Q_QUICKPARTICLES_EXPORT QQuickAngleDirection : public QQuickDirection |
| 24 | { |
| 25 | Q_OBJECT |
| 26 | Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged) |
| 27 | Q_PROPERTY(qreal magnitude READ magnitude WRITE setMagnitude NOTIFY magnitudeChanged) |
| 28 | Q_PROPERTY(qreal angleVariation READ angleVariation WRITE setAngleVariation NOTIFY angleVariationChanged) |
| 29 | Q_PROPERTY(qreal magnitudeVariation READ magnitudeVariation WRITE setMagnitudeVariation NOTIFY magnitudeVariationChanged) |
| 30 | QML_NAMED_ELEMENT(AngleDirection) |
| 31 | QML_ADDED_IN_VERSION(2, 0) |
| 32 | public: |
| 33 | explicit QQuickAngleDirection(QObject *parent = nullptr); |
| 34 | QPointF sample(const QPointF &from) override; |
| 35 | qreal angle() const |
| 36 | { |
| 37 | return m_angle; |
| 38 | } |
| 39 | |
| 40 | qreal magnitude() const |
| 41 | { |
| 42 | return m_magnitude; |
| 43 | } |
| 44 | |
| 45 | qreal angleVariation() const |
| 46 | { |
| 47 | return m_angleVariation; |
| 48 | } |
| 49 | |
| 50 | qreal magnitudeVariation() const |
| 51 | { |
| 52 | return m_magnitudeVariation; |
| 53 | } |
| 54 | |
| 55 | Q_SIGNALS: |
| 56 | |
| 57 | void angleChanged(qreal arg); |
| 58 | |
| 59 | void magnitudeChanged(qreal arg); |
| 60 | |
| 61 | void angleVariationChanged(qreal arg); |
| 62 | |
| 63 | void magnitudeVariationChanged(qreal arg); |
| 64 | |
| 65 | public Q_SLOTS: |
| 66 | void setAngle(qreal arg) |
| 67 | { |
| 68 | if (m_angle != arg) { |
| 69 | m_angle = arg; |
| 70 | Q_EMIT angleChanged(arg); |
| 71 | } |
| 72 | } |
| 73 | |
| 74 | void setMagnitude(qreal arg) |
| 75 | { |
| 76 | if (m_magnitude != arg) { |
| 77 | m_magnitude = arg; |
| 78 | Q_EMIT magnitudeChanged(arg); |
| 79 | } |
| 80 | } |
| 81 | |
| 82 | void setAngleVariation(qreal arg) |
| 83 | { |
| 84 | if (m_angleVariation != arg) { |
| 85 | m_angleVariation = arg; |
| 86 | Q_EMIT angleVariationChanged(arg); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | void setMagnitudeVariation(qreal arg) |
| 91 | { |
| 92 | if (m_magnitudeVariation != arg) { |
| 93 | m_magnitudeVariation = arg; |
| 94 | Q_EMIT magnitudeVariationChanged(arg); |
| 95 | } |
| 96 | } |
| 97 | |
| 98 | private: |
| 99 | qreal m_angle; |
| 100 | qreal m_magnitude; |
| 101 | qreal m_angleVariation; |
| 102 | qreal m_magnitudeVariation; |
| 103 | }; |
| 104 | |
| 105 | QT_END_NAMESPACE |
| 106 | #endif // QQuickANGLEDDIRECTION_H |
| 107 |
