60 for (
int i=0;
i<m_gridSize;
i++)
65 for (
int i=0;
i<m_gridSize;
i++)
66 free(m_vectorField[
i]);
71void QQuickTurbulenceAffector::initializeGrid()
77 if (m_gridSize !=
arg) {
79 for (
int i=0;
i<m_gridSize;
i++)
84 for (
int i=0;
i<m_gridSize;
i++)
85 free(m_vectorField[
i]);
91 m_field = (
qreal**)malloc(m_gridSize *
sizeof(
qreal*));
92 for (
int i=0;
i<m_gridSize;
i++)
93 m_field[
i] = (
qreal*)malloc(m_gridSize *
sizeof(
qreal));
95 for (
int i=0;
i<m_gridSize;
i++)
104 for (
int i=0;
i<m_gridSize;
i++)
105 for (
int j=0;
j<m_gridSize;
j++)
107 for (
int i=0;
i<m_gridSize;
i++){
108 for (
int j=0;
j<m_gridSize;
j++){
109 m_vectorField[
i][
j].
setX(boundsRespectingField(
i-1,
j) - boundsRespectingField(
i,
j));
110 m_vectorField[
i][
j].
setY(boundsRespectingField(
i,
j) - boundsRespectingField(
i,
j-1));
115qreal QQuickTurbulenceAffector::boundsRespectingField(
int x,
int y)
125 return m_field[
x][
y];
128void QQuickTurbulenceAffector::ensureInit()
146 QRect boundsRect(0,0,m_gridSize,m_gridSize);
158 fx += m_vectorField[
pos.x()][
pos.y()].
x() * m_strength;
159 fy += m_vectorField[
pos.x()][
pos.y()].
y() * m_strength;
171#include "moc_qquickturbulence_p.cpp"
QImage scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
\inmodule QtCore\reentrant
constexpr qreal x() const noexcept
Returns the x coordinate of this point.
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
constexpr void setY(qreal y) noexcept
Sets the y coordinate of this point to the given finite y coordinate.
constexpr void setX(qreal x) noexcept
Sets the x coordinate of this point to the given finite x coordinate.
\inmodule QtCore\reentrant
static QString urlToLocalFileOrQrc(const QString &)
If url is a local file returns a path suitable for passing to QFile.
The QQuickItem class provides the most basic of all visual items in \l {Qt Quick}.
qreal x
\qmlproperty real QtQuick::Item::x \qmlproperty real QtQuick::Item::y \qmlproperty real QtQuick::Item...
qreal y
Defines the item's y position relative to its parent.
qreal width
This property holds the width of this item.
qreal height
This property holds the height of this item.
void postAffect(QQuickParticleData *datum)
QQuickParticleSystem * m_system
bool shouldAffect(QQuickParticleData *datum)
QVarLengthArray< QQuickParticleGroupData *, 32 > groupData
void affectSystem(qreal dt) override
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override
QQuickTurbulenceAffector(QQuickItem *parent=nullptr)
\qmltype Turbulence \instantiates QQuickTurbulenceAffector \inqmlmodule QtQuick.Particles\inherits Af...
~QQuickTurbulenceAffector()
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
bool contains(const QRect &r, bool proper=false) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
bool isEmpty() const
Returns true if the URL has no data; otherwise returns false.
Combined button and popup list for selecting options.
constexpr const T & qMax(const T &a, const T &b)
GLint GLint GLint GLint GLint x
[0]
constexpr int qGray(int r, int g, int b)
#define QStringLiteral(str)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent