Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qquicktargetdirection_p.h
Go to the documentation of this file.
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 DIRECTEDVECTOR_H
5#define DIRECTEDVECTOR_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 <QtQml/qqml.h>
19
21
22class QQuickItem;
23class Q_QUICKPARTICLES_EXPORT QQuickTargetDirection : public QQuickDirection
24{
26 Q_PROPERTY(qreal targetX READ targetX WRITE setTargetX NOTIFY targetXChanged)
27 Q_PROPERTY(qreal targetY READ targetY WRITE setTargetY NOTIFY targetYChanged)
28 //If targetItem is set, X/Y are ignored. Aims at middle of item, use variation for variation
29 Q_PROPERTY(QQuickItem* targetItem READ targetItem WRITE setTargetItem NOTIFY targetItemChanged)
30
31 Q_PROPERTY(qreal targetVariation READ targetVariation WRITE setTargetVariation NOTIFY targetVariationChanged)
32
33 //TODO: An enum would be better
34 Q_PROPERTY(bool proportionalMagnitude READ proportionalMagnitude WRITE setProportionalMagnitude NOTIFY proprotionalMagnitudeChanged)
35 Q_PROPERTY(qreal magnitude READ magnitude WRITE setMagnitude NOTIFY magnitudeChanged)
36 Q_PROPERTY(qreal magnitudeVariation READ magnitudeVariation WRITE setMagnitudeVariation NOTIFY magnitudeVariationChanged)
37 QML_NAMED_ELEMENT(TargetDirection)
39
40public:
41 explicit QQuickTargetDirection(QObject *parent = nullptr);
42 QPointF sample(const QPointF &from) override;
43
44 qreal targetX() const
45 {
46 return m_targetX;
47 }
48
49 qreal targetY() const
50 {
51 return m_targetY;
52 }
53
55 {
56 return m_targetVariation;
57 }
58
60 {
61 return m_magnitude;
62 }
63
65 {
66 return m_proportionalMagnitude;
67 }
68
70 {
71 return m_magnitudeVariation;
72 }
73
75 {
76 return m_targetItem;
77 }
78
80
82
84
86
88
90
92
94
95public Q_SLOTS:
97 {
98 if (m_targetX != arg) {
99 m_targetX = arg;
100 Q_EMIT targetXChanged(arg);
101 }
102 }
103
105 {
106 if (m_targetY != arg) {
107 m_targetY = arg;
108 Q_EMIT targetYChanged(arg);
109 }
110 }
111
113 {
114 if (m_targetVariation != arg) {
115 m_targetVariation = arg;
116 Q_EMIT targetVariationChanged(arg);
117 }
118 }
119
121 {
122 if (m_magnitude != arg) {
123 m_magnitude = arg;
124 Q_EMIT magnitudeChanged(arg);
125 }
126 }
127
129 {
130 if (m_proportionalMagnitude != arg) {
131 m_proportionalMagnitude = arg;
132 Q_EMIT proprotionalMagnitudeChanged(arg);
133 }
134 }
135
137 {
138 if (m_magnitudeVariation != arg) {
139 m_magnitudeVariation = arg;
140 Q_EMIT magnitudeVariationChanged(arg);
141 }
142 }
143
145 {
146 if (m_targetItem != arg) {
147 m_targetItem = arg;
148 Q_EMIT targetItemChanged(arg);
149 }
150 }
151
152private:
153 qreal m_targetX;
154 qreal m_targetY;
155 qreal m_targetVariation;
156 bool m_proportionalMagnitude;
157 qreal m_magnitude;
158 qreal m_magnitudeVariation;
159 QQuickItem *m_targetItem;
160};
161
163#endif // DIRECTEDVECTOR_H
\inmodule QtCore
Definition qobject.h:103
\inmodule QtCore\reentrant
Definition qpoint.h:217
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
Definition qquickitem.h:63
void targetVariationChanged(qreal arg)
void targetXChanged(qreal arg)
QQuickItem * targetItem() const
void magnitudeVariationChanged(qreal arg)
void targetYChanged(qreal arg)
void magnitudeChanged(qreal arg)
void setTargetItem(QQuickItem *arg)
void targetItemChanged(QQuickItem *arg)
void proprotionalMagnitudeChanged(bool arg)
Combined button and popup list for selecting options.
#define QML_NAMED_ELEMENT(NAME)
#define QML_ADDED_IN_VERSION(MAJOR, MINOR)
SSL_CTX int void * arg
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_EMIT
#define Q_SLOTS
#define Q_SIGNALS
double qreal
Definition qtypes.h:187
#define explicit