Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qquickcustomaffector_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
CUSTOMAFFECTOR_H
5
#
define
CUSTOMAFFECTOR_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
18
#
include
<
QObject
>
19
#
include
<
QtQml
/
qqml
.
h
>
20
#
include
"qquickparticlesystem_p.h"
21
#
include
"qquickparticleextruder_p.h"
22
#
include
"qquickparticleaffector_p.h"
23
#
include
"qquickdirection_p.h"
24
25
QT_BEGIN_NAMESPACE
26
27
class
Q_QUICKPARTICLES_EXPORT
QQuickCustomAffector
:
public
QQuickParticleAffector
28
{
29
Q_OBJECT
30
Q_PROPERTY(
bool
relative READ relative WRITE setRelative NOTIFY relativeChanged)
31
Q_PROPERTY(QQuickDirection *position READ position WRITE setPosition NOTIFY positionChanged RESET positionReset)
32
Q_PROPERTY(QQuickDirection *velocity READ velocity WRITE setVelocity NOTIFY velocityChanged RESET velocityReset)
33
Q_PROPERTY(QQuickDirection *acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged RESET accelerationReset)
34
QML_NAMED_ELEMENT(Affector)
35
QML_ADDED_IN_VERSION(2, 0)
36
37
public
:
38
explicit
QQuickCustomAffector(QQuickItem *parent =
nullptr
);
39
void
affectSystem(qreal dt) override;
40
41
QQuickDirection * position()
const
42
{
43
return
m_position;
44
}
45
46
QQuickDirection * velocity()
const
47
{
48
return
m_velocity;
49
}
50
51
QQuickDirection * acceleration()
const
52
{
53
return
m_acceleration;
54
}
55
56
void
positionReset()
57
{
58
m_position = &m_nullVector;
59
}
60
61
void
velocityReset()
62
{
63
m_velocity = &m_nullVector;
64
}
65
66
void
accelerationReset()
67
{
68
m_acceleration = &m_nullVector;
69
}
70
71
bool
relative()
const
72
{
73
return
m_relative;
74
}
75
76
77
Q_SIGNALS:
78
void
affectParticles(
const
QList<QQuickV4ParticleData> &particles, qreal dt);
79
80
void
positionChanged(QQuickDirection * arg);
81
82
void
velocityChanged(QQuickDirection * arg);
83
84
void
accelerationChanged(QQuickDirection * arg);
85
86
void
relativeChanged(
bool
arg);
87
88
public
Q_SLOTS:
89
void
setPosition(QQuickDirection * arg)
90
{
91
if
(m_position != arg) {
92
m_position = arg;
93
Q_EMIT positionChanged(arg);
94
}
95
}
96
97
void
setVelocity(QQuickDirection * arg)
98
{
99
if
(m_velocity != arg) {
100
m_velocity = arg;
101
Q_EMIT velocityChanged(arg);
102
}
103
}
104
105
void
setAcceleration(QQuickDirection * arg)
106
{
107
if
(m_acceleration != arg) {
108
m_acceleration = arg;
109
Q_EMIT accelerationChanged(arg);
110
}
111
}
112
113
void
setRelative(
bool
arg)
114
{
115
if
(m_relative != arg) {
116
m_relative = arg;
117
Q_EMIT relativeChanged(arg);
118
}
119
}
120
121
protected
:
122
bool
isAffectConnected();
123
bool
affectParticle(QQuickParticleData *d, qreal dt) override;
124
125
private
:
126
void
affectProperties(
const
QList<QQuickParticleData*> &particles, qreal dt);
127
QQuickDirection * m_position;
128
QQuickDirection * m_velocity;
129
QQuickDirection * m_acceleration;
130
131
QQuickDirection m_nullVector;
132
bool
m_relative;
133
};
134
135
QT_END_NAMESPACE
136
#
endif
// CUSTOMAFFECTOR_H
QQuickCustomAffector
Definition
qquickcustomaffector_p.h:28
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
qtdeclarative
src
particles
qquickcustomaffector_p.h
Generated on
for Qt by
1.18.0