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
qquickturbulence_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 TURBULENCEAFFECTOR_H
5#define TURBULENCEAFFECTOR_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//
18#include <QQmlListProperty>
19
21
23
24class Q_QUICKPARTICLES_EXPORT QQuickTurbulenceAffector : public QQuickParticleAffector
25{
27 Q_PROPERTY(qreal strength READ strength WRITE setStrength NOTIFY strengthChanged)
28 Q_PROPERTY(QUrl noiseSource READ noiseSource WRITE setNoiseSource NOTIFY noiseSourceChanged)
29 QML_NAMED_ELEMENT(Turbulence)
31
32public:
35 void affectSystem(qreal dt) override;
36
37 qreal strength() const
38 {
39 return m_strength;
40 }
41
43 {
44 return m_noiseSource;
45 }
47
49
51
52public Q_SLOTS:
53
55 {
56 if (m_strength != arg) {
57 m_strength = arg;
58 Q_EMIT strengthChanged(arg);
59 }
60 }
61
62 void setNoiseSource(const QUrl &arg)
63 {
64 if (m_noiseSource != arg) {
65 m_noiseSource = arg;
66 Q_EMIT noiseSourceChanged(arg);
67 initializeGrid();
68 }
69 }
70
71protected:
72 void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
73private:
74 void ensureInit();
75 void mapUpdate();
76 void initializeGrid();
77 qreal boundsRespectingField(int x, int y);
78 qreal m_strength;
79 int m_gridSize;
80 qreal** m_field;
81 QPointF** m_vectorField;
82 bool m_inited;
83 QUrl m_noiseSource;
84};
85
87#endif // TURBULENCEAFFECTOR_H
\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 setNoiseSource(const QUrl &arg)
void strengthChanged(qreal arg)
void noiseSourceChanged(const QUrl &arg)
\inmodule QtCore\reentrant
Definition qrect.h:484
\inmodule QtCore
Definition qurl.h:94
Combined button and popup list for selecting options.
GLint GLint GLint GLint GLint x
[0]
GLint y
#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