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 POINTVECTOR_H |
5 | #define POINTVECTOR_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 | |
19 | QT_BEGIN_NAMESPACE |
20 | |
21 | class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickPointDirection : public QQuickDirection |
22 | { |
23 | Q_OBJECT |
24 | Q_PROPERTY(qreal x READ x WRITE setX NOTIFY xChanged FINAL) |
25 | Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged FINAL) |
26 | Q_PROPERTY(qreal xVariation READ xVariation WRITE setXVariation NOTIFY xVariationChanged FINAL) |
27 | Q_PROPERTY(qreal yVariation READ yVariation WRITE setYVariation NOTIFY yVariationChanged FINAL) |
28 | QML_NAMED_ELEMENT(PointDirection) |
29 | QML_ADDED_IN_VERSION(2, 0) |
30 | public: |
31 | explicit QQuickPointDirection(QObject *parent = nullptr); |
32 | QPointF sample(const QPointF &from) override; |
33 | qreal x() const |
34 | { |
35 | return m_x; |
36 | } |
37 | |
38 | qreal y() const |
39 | { |
40 | return m_y; |
41 | } |
42 | |
43 | qreal xVariation() const |
44 | { |
45 | return m_xVariation; |
46 | } |
47 | |
48 | qreal yVariation() const |
49 | { |
50 | return m_yVariation; |
51 | } |
52 | |
53 | Q_SIGNALS: |
54 | |
55 | void xChanged(qreal arg); |
56 | |
57 | void yChanged(qreal arg); |
58 | |
59 | void xVariationChanged(qreal arg); |
60 | |
61 | void yVariationChanged(qreal arg); |
62 | |
63 | public Q_SLOTS: |
64 | void setX(qreal arg) |
65 | { |
66 | if (m_x != arg) { |
67 | m_x = arg; |
68 | Q_EMIT xChanged(arg); |
69 | } |
70 | } |
71 | |
72 | void setY(qreal arg) |
73 | { |
74 | if (m_y != arg) { |
75 | m_y = arg; |
76 | Q_EMIT yChanged(arg); |
77 | } |
78 | } |
79 | |
80 | void setXVariation(qreal arg) |
81 | { |
82 | if (m_xVariation != arg) { |
83 | m_xVariation = arg; |
84 | Q_EMIT xVariationChanged(arg); |
85 | } |
86 | } |
87 | |
88 | void setYVariation(qreal arg) |
89 | { |
90 | if (m_yVariation != arg) { |
91 | m_yVariation = arg; |
92 | Q_EMIT yVariationChanged(arg); |
93 | } |
94 | } |
95 | |
96 | private: |
97 | |
98 | qreal m_x; |
99 | qreal m_y; |
100 | qreal m_xVariation; |
101 | qreal m_yVariation; |
102 | }; |
103 | |
104 | QT_END_NAMESPACE |
105 | #endif // POINTVECTOR_H |
106 |