aboutsummaryrefslogtreecommitdiffstats
path: root/src/particles
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-10-14 18:46:38 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-10-14 19:02:37 +0200
commitc2f8b9535d34da6948ccf45b7d5fd90de2f1bc9e (patch)
treec6f7e058a985d7c18b51cadc76283caf555071c9 /src/particles
parent9e633bbda7608ac0231809e2a6a97ae8f2d849d6 (diff)
parent803f18f02e5609a1ca00a5b78ea6d3613d44e1a0 (diff)
Merge remote-tracking branch 'origin/dev' into wip/cmake
Removed dependencies.yaml because we don't use it yet in wip/cmake. Fixed conflict in qmlcachegen.cpp. Change-Id: Ie1060c737bee1daa85779903598e5b6d5020d922
Diffstat (limited to 'src/particles')
-rw-r--r--src/particles/qquickage_p.h1
-rw-r--r--src/particles/qquickangledirection_p.h3
-rw-r--r--src/particles/qquickcumulativedirection_p.h3
-rw-r--r--src/particles/qquickcustomaffector.cpp2
-rw-r--r--src/particles/qquickcustomaffector_p.h4
-rw-r--r--src/particles/qquickcustomparticle_p.h1
-rw-r--r--src/particles/qquickdirection_p.h4
-rw-r--r--src/particles/qquickellipseextruder_p.h1
-rw-r--r--src/particles/qquickfriction_p.h1
-rw-r--r--src/particles/qquickgravity_p.h2
-rw-r--r--src/particles/qquickgroupgoal_p.h1
-rw-r--r--src/particles/qquickimageparticle.cpp20
-rw-r--r--src/particles/qquickimageparticle_p.h1
-rw-r--r--src/particles/qquickitemparticle.cpp20
-rw-r--r--src/particles/qquickitemparticle_p.h4
-rw-r--r--src/particles/qquicklineextruder_p.h1
-rw-r--r--src/particles/qquickmaskextruder.cpp4
-rw-r--r--src/particles/qquickmaskextruder_p.h5
-rw-r--r--src/particles/qquickparticleaffector.cpp2
-rw-r--r--src/particles/qquickparticleaffector_p.h3
-rw-r--r--src/particles/qquickparticleemitter.cpp15
-rw-r--r--src/particles/qquickparticleemitter_p.h1
-rw-r--r--src/particles/qquickparticleextruder_p.h4
-rw-r--r--src/particles/qquickparticlegroup_p.h1
-rw-r--r--src/particles/qquickparticlepainter_p.h3
-rw-r--r--src/particles/qquickparticlesmodule.cpp64
-rw-r--r--src/particles/qquickparticlesystem_p.h1
-rw-r--r--src/particles/qquickpointattractor_p.h1
-rw-r--r--src/particles/qquickpointdirection_p.h1
-rw-r--r--src/particles/qquickrectangleextruder_p.h1
-rw-r--r--src/particles/qquickspritegoal_p.h1
-rw-r--r--src/particles/qquicktargetdirection_p.h3
-rw-r--r--src/particles/qquicktrailemitter_p.h1
-rw-r--r--src/particles/qquickturbulence_p.h4
-rw-r--r--src/particles/qquickwander_p.h1
35 files changed, 119 insertions, 66 deletions
diff --git a/src/particles/qquickage_p.h b/src/particles/qquickage_p.h
index 5db6167dc1..890c6a63c1 100644
--- a/src/particles/qquickage_p.h
+++ b/src/particles/qquickage_p.h
@@ -59,6 +59,7 @@ class QQuickAgeAffector : public QQuickParticleAffector
Q_OBJECT
Q_PROPERTY(int lifeLeft READ lifeLeft WRITE setLifeLeft NOTIFY lifeLeftChanged)
Q_PROPERTY(bool advancePosition READ advancePosition WRITE setAdvancePosition NOTIFY advancePositionChanged)
+ QML_NAMED_ELEMENT(Age)
public:
explicit QQuickAgeAffector(QQuickItem *parent = 0);
diff --git a/src/particles/qquickangledirection_p.h b/src/particles/qquickangledirection_p.h
index 66290fb19e..d0fdf5a68c 100644
--- a/src/particles/qquickangledirection_p.h
+++ b/src/particles/qquickangledirection_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
#include "qquickdirection_p.h"
+#include <QtQml/qqml.h>
+
QT_BEGIN_NAMESPACE
class QQuickAngleDirection : public QQuickDirection
@@ -60,6 +62,7 @@ class QQuickAngleDirection : public QQuickDirection
Q_PROPERTY(qreal magnitude READ magnitude WRITE setMagnitude NOTIFY magnitudeChanged)
Q_PROPERTY(qreal angleVariation READ angleVariation WRITE setAngleVariation NOTIFY angleVariationChanged)
Q_PROPERTY(qreal magnitudeVariation READ magnitudeVariation WRITE setMagnitudeVariation NOTIFY magnitudeVariationChanged)
+ QML_NAMED_ELEMENT(AngleDirection)
public:
explicit QQuickAngleDirection(QObject *parent = 0);
QPointF sample(const QPointF &from) override;
diff --git a/src/particles/qquickcumulativedirection_p.h b/src/particles/qquickcumulativedirection_p.h
index 39f8ab8a24..5160d8f09a 100644
--- a/src/particles/qquickcumulativedirection_p.h
+++ b/src/particles/qquickcumulativedirection_p.h
@@ -52,6 +52,8 @@
//
#include "qquickdirection_p.h"
#include <QQmlListProperty>
+#include <QtQml/qqml.h>
+
QT_BEGIN_NAMESPACE
class QQuickCumulativeDirection : public QQuickDirection
@@ -59,6 +61,7 @@ class QQuickCumulativeDirection : public QQuickDirection
Q_OBJECT
Q_PROPERTY(QQmlListProperty<QQuickDirection> directions READ directions)
Q_CLASSINFO("DefaultProperty", "directions")
+ QML_NAMED_ELEMENT(CumulativeDirection)
public:
explicit QQuickCumulativeDirection(QObject *parent = 0);
QQmlListProperty<QQuickDirection> directions();
diff --git a/src/particles/qquickcustomaffector.cpp b/src/particles/qquickcustomaffector.cpp
index cadd2992b1..5e2133dfaf 100644
--- a/src/particles/qquickcustomaffector.cpp
+++ b/src/particles/qquickcustomaffector.cpp
@@ -233,7 +233,7 @@ bool QQuickCustomAffector::affectParticle(QQuickParticleData *d, qreal dt)
return changed;
}
-void QQuickCustomAffector::affectProperties(const QList<QQuickParticleData*> particles, qreal dt)
+void QQuickCustomAffector::affectProperties(const QList<QQuickParticleData*> &particles, qreal dt)
{
foreach (QQuickParticleData* d, particles)
if ( affectParticle(d, dt) )
diff --git a/src/particles/qquickcustomaffector_p.h b/src/particles/qquickcustomaffector_p.h
index 10db70d71d..5e8671514d 100644
--- a/src/particles/qquickcustomaffector_p.h
+++ b/src/particles/qquickcustomaffector_p.h
@@ -52,6 +52,7 @@
//
#include <QObject>
+#include <QtQml/qqml.h>
#include "qquickparticlesystem_p.h"
#include "qquickparticleextruder_p.h"
#include "qquickparticleaffector_p.h"
@@ -66,6 +67,7 @@ class QQuickCustomAffector : public QQuickParticleAffector
Q_PROPERTY(QQuickDirection *position READ position WRITE setPosition NOTIFY positionChanged RESET positionReset)
Q_PROPERTY(QQuickDirection *velocity READ velocity WRITE setVelocity NOTIFY velocityChanged RESET velocityReset)
Q_PROPERTY(QQuickDirection *acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged RESET accelerationReset)
+ QML_NAMED_ELEMENT(Affector)
public:
explicit QQuickCustomAffector(QQuickItem *parent = 0);
@@ -156,7 +158,7 @@ protected:
bool affectParticle(QQuickParticleData *d, qreal dt) override;
private:
- void affectProperties(const QList<QQuickParticleData*> particles, qreal dt);
+ void affectProperties(const QList<QQuickParticleData*> &particles, qreal dt);
QQuickDirection * m_position;
QQuickDirection * m_velocity;
QQuickDirection * m_acceleration;
diff --git a/src/particles/qquickcustomparticle_p.h b/src/particles/qquickcustomparticle_p.h
index e2292cb33b..444f7ad215 100644
--- a/src/particles/qquickcustomparticle_p.h
+++ b/src/particles/qquickcustomparticle_p.h
@@ -67,6 +67,7 @@ class QQuickCustomParticle : public QQuickParticlePainter
Q_OBJECT
Q_PROPERTY(QByteArray fragmentShader READ fragmentShader WRITE setFragmentShader NOTIFY fragmentShaderChanged)
Q_PROPERTY(QByteArray vertexShader READ vertexShader WRITE setVertexShader NOTIFY vertexShaderChanged)
+ QML_NAMED_ELEMENT(CustomParticle)
public:
explicit QQuickCustomParticle(QQuickItem* parent=0);
diff --git a/src/particles/qquickdirection_p.h b/src/particles/qquickdirection_p.h
index 10960f9920..60b4d8eb1d 100644
--- a/src/particles/qquickdirection_p.h
+++ b/src/particles/qquickdirection_p.h
@@ -53,12 +53,16 @@
#include <QObject>
#include <QPointF>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
class QQuickDirection : public QObject
{
Q_OBJECT
+ QML_NAMED_ELEMENT(NullVector)
+ QML_UNCREATABLE("Abstract type. Use one of the inheriting types instead.")
+
public:
explicit QQuickDirection(QObject *parent = 0);
diff --git a/src/particles/qquickellipseextruder_p.h b/src/particles/qquickellipseextruder_p.h
index 0af7f4d94f..c92443fedf 100644
--- a/src/particles/qquickellipseextruder_p.h
+++ b/src/particles/qquickellipseextruder_p.h
@@ -58,6 +58,7 @@ class QQuickEllipseExtruder : public QQuickParticleExtruder
{
Q_OBJECT
Q_PROPERTY(bool fill READ fill WRITE setFill NOTIFY fillChanged)//###Use base class? If it's still box
+ QML_NAMED_ELEMENT(EllipseShape)
public:
explicit QQuickEllipseExtruder(QObject *parent = 0);
QPointF extrude(const QRectF &) override;
diff --git a/src/particles/qquickfriction_p.h b/src/particles/qquickfriction_p.h
index 05ae7a38d5..5686bb37d5 100644
--- a/src/particles/qquickfriction_p.h
+++ b/src/particles/qquickfriction_p.h
@@ -59,6 +59,7 @@ class QQuickFrictionAffector : public QQuickParticleAffector
Q_OBJECT
Q_PROPERTY(qreal factor READ factor WRITE setFactor NOTIFY factorChanged)
Q_PROPERTY(qreal threshold READ threshold WRITE setThreshold NOTIFY thresholdChanged)
+ QML_NAMED_ELEMENT(Friction)
public:
explicit QQuickFrictionAffector(QQuickItem *parent = 0);
diff --git a/src/particles/qquickgravity_p.h b/src/particles/qquickgravity_p.h
index 333d3d1534..ef7cc770b7 100644
--- a/src/particles/qquickgravity_p.h
+++ b/src/particles/qquickgravity_p.h
@@ -51,6 +51,7 @@
// We mean it.
//
#include "qquickparticleaffector_p.h"
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -60,6 +61,7 @@ class QQuickGravityAffector : public QQuickParticleAffector
Q_PROPERTY(qreal magnitude READ magnitude WRITE setMagnitude NOTIFY magnitudeChanged)
Q_PROPERTY(qreal acceleration READ magnitude WRITE setAcceleration NOTIFY magnitudeChanged)
Q_PROPERTY(qreal angle READ angle WRITE setAngle NOTIFY angleChanged)
+ QML_NAMED_ELEMENT(Gravity)
public:
explicit QQuickGravityAffector(QQuickItem *parent = 0);
qreal magnitude() const;
diff --git a/src/particles/qquickgroupgoal_p.h b/src/particles/qquickgroupgoal_p.h
index 9a56ef5cce..022b244ed7 100644
--- a/src/particles/qquickgroupgoal_p.h
+++ b/src/particles/qquickgroupgoal_p.h
@@ -61,6 +61,7 @@ class QQuickGroupGoalAffector : public QQuickParticleAffector
Q_OBJECT
Q_PROPERTY(QString goalState READ goalState WRITE setGoalState NOTIFY goalStateChanged)
Q_PROPERTY(bool jump READ jump WRITE setJump NOTIFY jumpChanged)
+ QML_NAMED_ELEMENT(GroupGoal)
public:
explicit QQuickGroupGoalAffector(QQuickItem *parent = 0);
diff --git a/src/particles/qquickimageparticle.cpp b/src/particles/qquickimageparticle.cpp
index 649fbb30c2..bd3865f42f 100644
--- a/src/particles/qquickimageparticle.cpp
+++ b/src/particles/qquickimageparticle.cpp
@@ -179,7 +179,7 @@ public:
setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_tabled.frag.qsb"));
}
- bool updateUniformData(const RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
+ bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
{
QByteArray *buf = renderState.uniformData();
Q_ASSERT(buf->size() >= 80 + 2 * (UNIFORM_ARRAY_SIZE * 4 * 4));
@@ -216,7 +216,7 @@ public:
return true;
}
- void updateSampledImage(const RenderState &renderState, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &renderState, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *) override
{
ImageMaterialData *state = static_cast<ImageMaterial *>(newMaterial)->state();
@@ -331,7 +331,7 @@ public:
setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_deformed.frag.qsb"));
}
- bool updateUniformData(const RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
+ bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
{
QByteArray *buf = renderState.uniformData();
Q_ASSERT(buf->size() >= 80 + 2 * (UNIFORM_ARRAY_SIZE * 4 * 4));
@@ -357,7 +357,7 @@ public:
return true;
}
- void updateSampledImage(const RenderState &renderState, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &renderState, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *) override
{
ImageMaterialData *state = static_cast<ImageMaterial *>(newMaterial)->state();
@@ -487,7 +487,7 @@ public:
setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_sprite.frag.qsb"));
}
- bool updateUniformData(const RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
+ bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
{
QByteArray *buf = renderState.uniformData();
Q_ASSERT(buf->size() >= 80 + 2 * (UNIFORM_ARRAY_SIZE * 4 * 4));
@@ -524,7 +524,7 @@ public:
return true;
}
- void updateSampledImage(const RenderState &renderState, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &renderState, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *) override
{
ImageMaterialData *state = static_cast<ImageMaterial *>(newMaterial)->state();
@@ -651,7 +651,7 @@ public:
setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_colored.frag.qsb"));
}
- bool updateUniformData(const RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
+ bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
{
QByteArray *buf = renderState.uniformData();
Q_ASSERT(buf->size() >= 80 + 2 * (UNIFORM_ARRAY_SIZE * 4 * 4));
@@ -677,7 +677,7 @@ public:
return true;
}
- void updateSampledImage(const RenderState &renderState, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &renderState, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *) override
{
ImageMaterialData *state = static_cast<ImageMaterial *>(newMaterial)->state();
@@ -799,7 +799,7 @@ public:
setShaderFileName(FragmentStage, QStringLiteral(":/particles/shaders_ng/imageparticle_simple.frag.qsb"));
}
- bool updateUniformData(const RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
+ bool updateUniformData(RenderState &renderState, QSGMaterial *newMaterial, QSGMaterial *) override
{
QByteArray *buf = renderState.uniformData();
Q_ASSERT(buf->size() >= 80 + 2 * (UNIFORM_ARRAY_SIZE * 4 * 4));
@@ -825,7 +825,7 @@ public:
return true;
}
- void updateSampledImage(const RenderState &renderState, int binding, QSGTexture **texture,
+ void updateSampledImage(RenderState &renderState, int binding, QSGTexture **texture,
QSGMaterial *newMaterial, QSGMaterial *) override
{
ImageMaterialData *state = static_cast<ImageMaterial *>(newMaterial)->state();
diff --git a/src/particles/qquickimageparticle_p.h b/src/particles/qquickimageparticle_p.h
index 059cf67019..83fc75e9c9 100644
--- a/src/particles/qquickimageparticle_p.h
+++ b/src/particles/qquickimageparticle_p.h
@@ -202,6 +202,7 @@ class QQuickImageParticle : public QQuickParticlePainter
Q_PROPERTY(bool spritesInterpolate READ spritesInterpolate WRITE setSpritesInterpolate NOTIFY spritesInterpolateChanged)
Q_PROPERTY(EntryEffect entryEffect READ entryEffect WRITE setEntryEffect NOTIFY entryEffectChanged)
+ QML_NAMED_ELEMENT(ImageParticle)
public:
explicit QQuickImageParticle(QQuickItem *parent = 0);
virtual ~QQuickImageParticle();
diff --git a/src/particles/qquickitemparticle.cpp b/src/particles/qquickitemparticle.cpp
index e68ea54707..fc28864746 100644
--- a/src/particles/qquickitemparticle.cpp
+++ b/src/particles/qquickitemparticle.cpp
@@ -59,32 +59,38 @@ QT_BEGIN_NAMESPACE
/*!
\qmlmethod QtQuick.Particles::ItemParticle::freeze(Item item)
- Suspends the flow of time for the logical particle which item represents, allowing you to control its movement.
+ Suspends the flow of time for the logical particle which \a item represents,
+ allowing you to control its movement.
*/
/*!
\qmlmethod QtQuick.Particles::ItemParticle::unfreeze(Item item)
- Restarts the flow of time for the logical particle which item represents, allowing it to be moved by the particle system again.
+ Restarts the flow of time for the logical particle which \a item represents,
+ allowing it to be moved by the particle system again.
*/
/*!
\qmlmethod QtQuick.Particles::ItemParticle::take(Item item, bool prioritize)
- Asks the ItemParticle to take over control of item positioning temporarily.
+ Asks the ItemParticle to take over control of \a item positioning temporarily.
It will follow the movement of a logical particle when one is available.
- By default items form a queue when waiting for a logical particle, but if prioritize is true then it will go immediately to the
- head of the queue.
+ By default items form a queue when waiting for a logical particle, but if
+ \a prioritize is \c true, then it will go immediately to the head of the
+ queue.
ItemParticle does not take ownership of the item, and will relinquish
control when the logical particle expires. Commonly at this point you will
want to put it back in the queue, you can do this with the below line in
the delegate definition:
+
\code
ItemParticle.onDetached: itemParticleInstance.take(delegateRootItem);
\endcode
+
or delete it, such as with the below line in the delegate definition:
+
\code
ItemParticle.onDetached: delegateRootItem.destroy();
\endcode
@@ -93,7 +99,9 @@ QT_BEGIN_NAMESPACE
/*!
\qmlmethod QtQuick.Particles::ItemParticle::give(Item item)
- Orders the ItemParticle to give you control of the item. It will cease controlling it and the item will lose its association to the logical particle.
+ Orders the ItemParticle to give you control of the \a item. It will cease
+ controlling it and the item will lose its association to the logical
+ particle.
*/
/*!
diff --git a/src/particles/qquickitemparticle_p.h b/src/particles/qquickitemparticle_p.h
index 7867add4e4..70cfe2a446 100644
--- a/src/particles/qquickitemparticle_p.h
+++ b/src/particles/qquickitemparticle_p.h
@@ -63,6 +63,8 @@ class QQuickItemParticle : public QQuickParticlePainter
Q_OBJECT
Q_PROPERTY(bool fade READ fade WRITE setFade NOTIFY fadeChanged)
Q_PROPERTY(QQmlComponent* delegate READ delegate WRITE setDelegate NOTIFY delegateChanged)
+ QML_NAMED_ELEMENT(ItemParticle)
+ QML_ATTACHED(QQuickItemParticleAttached)
public:
explicit QQuickItemParticle(QQuickItem *parent = 0);
~QQuickItemParticle();
@@ -143,6 +145,4 @@ Q_SIGNALS:
QT_END_NAMESPACE
-QML_DECLARE_TYPEINFO(QQuickItemParticle, QML_HAS_ATTACHED_PROPERTIES)
-
#endif // ITEMPARTICLE_H
diff --git a/src/particles/qquicklineextruder_p.h b/src/particles/qquicklineextruder_p.h
index 306f3a1dd6..76ac5aaf11 100644
--- a/src/particles/qquicklineextruder_p.h
+++ b/src/particles/qquicklineextruder_p.h
@@ -57,6 +57,7 @@ class QQuickLineExtruder : public QQuickParticleExtruder
Q_OBJECT
//Default is topleft to bottom right. Flipped makes it topright to bottom left
Q_PROPERTY(bool mirrored READ mirrored WRITE setMirrored NOTIFY mirroredChanged)
+ QML_NAMED_ELEMENT(LineShape)
public:
explicit QQuickLineExtruder(QObject *parent = 0);
diff --git a/src/particles/qquickmaskextruder.cpp b/src/particles/qquickmaskextruder.cpp
index 4c5d9e9d88..2ce3650743 100644
--- a/src/particles/qquickmaskextruder.cpp
+++ b/src/particles/qquickmaskextruder.cpp
@@ -68,14 +68,14 @@ QQuickMaskExtruder::QQuickMaskExtruder(QObject *parent) :
{
}
-void QQuickMaskExtruder::setSource(QUrl arg)
+void QQuickMaskExtruder::setSource(const QUrl &arg)
{
if (m_source != arg) {
m_source = arg;
m_lastHeight = -1;//Trigger reset
m_lastWidth = -1;
- emit sourceChanged(arg);
+ emit sourceChanged(m_source);
startMaskLoading();
}
}
diff --git a/src/particles/qquickmaskextruder_p.h b/src/particles/qquickmaskextruder_p.h
index 0fc0331db8..419d162811 100644
--- a/src/particles/qquickmaskextruder_p.h
+++ b/src/particles/qquickmaskextruder_p.h
@@ -61,6 +61,7 @@ class QQuickMaskExtruder : public QQuickParticleExtruder
{
Q_OBJECT
Q_PROPERTY(QUrl source READ source WRITE setSource NOTIFY sourceChanged)
+ QML_NAMED_ELEMENT(MaskShape)
public:
explicit QQuickMaskExtruder(QObject *parent = 0);
QPointF extrude(const QRectF &) override;
@@ -73,10 +74,10 @@ public:
Q_SIGNALS:
- void sourceChanged(QUrl arg);
+ void sourceChanged(const QUrl &arg);
public Q_SLOTS:
- void setSource(QUrl arg);
+ void setSource(const QUrl &arg);
private Q_SLOTS:
void startMaskLoading();
diff --git a/src/particles/qquickparticleaffector.cpp b/src/particles/qquickparticleaffector.cpp
index 3d6035c577..ffbd5674f0 100644
--- a/src/particles/qquickparticleaffector.cpp
+++ b/src/particles/qquickparticleaffector.cpp
@@ -125,7 +125,7 @@ QT_BEGIN_NAMESPACE
themselves). As this executes JavaScript code per particle, it is not recommended to use this
signal with a high-volume particle system.
- x,y is the particle's current position.
+ (\a {x}, \a {y}) is the particle's current position.
The corresponding handler is \c onAffected.
*/
diff --git a/src/particles/qquickparticleaffector_p.h b/src/particles/qquickparticleaffector_p.h
index 5c9652bc32..fd4887333e 100644
--- a/src/particles/qquickparticleaffector_p.h
+++ b/src/particles/qquickparticleaffector_p.h
@@ -68,6 +68,9 @@ class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleAffector : public QQuickItem
Q_PROPERTY(bool once READ onceOff WRITE setOnceOff NOTIFY onceChanged)
Q_PROPERTY(QQuickParticleExtruder* shape READ shape WRITE setShape NOTIFY shapeChanged)
+ QML_NAMED_ELEMENT(ParticleAffector)
+ QML_UNCREATABLE("Abstract type. Use one of the inheriting types instead.")
+
public:
explicit QQuickParticleAffector(QQuickItem *parent = 0);
virtual void affectSystem(qreal dt);
diff --git a/src/particles/qquickparticleemitter.cpp b/src/particles/qquickparticleemitter.cpp
index 4e36ad149a..c0d9fa941d 100644
--- a/src/particles/qquickparticleemitter.cpp
+++ b/src/particles/qquickparticleemitter.cpp
@@ -191,10 +191,10 @@ QT_BEGIN_NAMESPACE
/*!
\qmlsignal QtQuick.Particles::Emitter::emitParticles(Array particles)
- This signal is emitted when particles are emitted. particles is a JavaScript
+ This signal is emitted when particles are emitted. \a particles is a JavaScript
array of Particle objects. You can modify particle attributes directly within the handler.
- Note that JavaScript is slower to execute, so it is not recommended to use this in
+ \note JavaScript is slower to execute, so it is not recommended to use this in
high-volume particle systems.
The corresponding handler is \c onEmitParticles.
@@ -202,19 +202,20 @@ QT_BEGIN_NAMESPACE
/*! \qmlmethod QtQuick.Particles::Emitter::burst(int count)
- Emits count particles from this emitter immediately.
+ Emits a number of particles, specified by \a count, from this emitter immediately.
*/
/*! \qmlmethod QtQuick.Particles::Emitter::burst(int count, int x, int y)
- Emits count particles from this emitter immediately. The particles are emitted
- as if the Emitter was positioned at x,y but all other properties are the same.
+ Emits a number of particles, specified by \a count, from this emitter immediately.
+ The particles are emitted as if the Emitter was positioned at (\a {x}, \a {y}) but
+ all other properties are the same.
*/
/*! \qmlmethod QtQuick.Particles::Emitter::pulse(int duration)
- If the emitter is not enabled, enables it for duration milliseconds and then switches
- it back off.
+ If the emitter is not enabled, enables it for a specified \a duration
+ (in milliseconds) and then switches it back off.
*/
QQuickParticleEmitter::QQuickParticleEmitter(QQuickItem *parent) :
diff --git a/src/particles/qquickparticleemitter_p.h b/src/particles/qquickparticleemitter_p.h
index 64b9bcef32..b97d3f812a 100644
--- a/src/particles/qquickparticleemitter_p.h
+++ b/src/particles/qquickparticleemitter_p.h
@@ -83,6 +83,7 @@ class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleEmitter : public QQuickItem
Q_PROPERTY(QQuickDirection *velocity READ velocity WRITE setVelocity NOTIFY velocityChanged)
Q_PROPERTY(QQuickDirection *acceleration READ acceleration WRITE setAcceleration NOTIFY accelerationChanged)
Q_PROPERTY(qreal velocityFromMovement READ velocityFromMovement WRITE setVelocityFromMovement NOTIFY velocityFromMovementChanged)
+ QML_NAMED_ELEMENT(Emitter)
public:
explicit QQuickParticleEmitter(QQuickItem *parent = 0);
diff --git a/src/particles/qquickparticleextruder_p.h b/src/particles/qquickparticleextruder_p.h
index 38b2e34c77..24f7a0a2fa 100644
--- a/src/particles/qquickparticleextruder_p.h
+++ b/src/particles/qquickparticleextruder_p.h
@@ -54,6 +54,7 @@
#include <QObject>
#include <QRectF>
#include <QPointF>
+#include <QtQml/qqml.h>
QT_BEGIN_NAMESPACE
@@ -61,6 +62,9 @@ class QQuickParticleExtruder : public QObject
{
Q_OBJECT
+ QML_NAMED_ELEMENT(ParticleExtruder)
+ QML_UNCREATABLE("Abstract type. Use one of the inheriting types instead.")
+
public:
explicit QQuickParticleExtruder(QObject *parent = 0);
virtual QPointF extrude(const QRectF &);
diff --git a/src/particles/qquickparticlegroup_p.h b/src/particles/qquickparticlegroup_p.h
index 0314234569..8d068fbe9c 100644
--- a/src/particles/qquickparticlegroup_p.h
+++ b/src/particles/qquickparticlegroup_p.h
@@ -66,6 +66,7 @@ class QQuickParticleGroup : public QQuickStochasticState, public QQmlParserStatu
//Intercept children requests and assign to the group & system
Q_PROPERTY(QQmlListProperty<QObject> particleChildren READ particleChildren DESIGNABLE false)//### Hidden property for in-state system definitions - ought not to be used in actual "Sprite" states
Q_CLASSINFO("DefaultProperty", "particleChildren")
+ QML_NAMED_ELEMENT(ParticleGroup)
Q_INTERFACES(QQmlParserStatus)
public:
diff --git a/src/particles/qquickparticlepainter_p.h b/src/particles/qquickparticlepainter_p.h
index 16fc6b6f45..e3d13b8a21 100644
--- a/src/particles/qquickparticlepainter_p.h
+++ b/src/particles/qquickparticlepainter_p.h
@@ -64,6 +64,9 @@ class QQuickParticlePainter : public QQuickItem
Q_PROPERTY(QQuickParticleSystem* system READ system WRITE setSystem NOTIFY systemChanged)
Q_PROPERTY(QStringList groups READ groups WRITE setGroups NOTIFY groupsChanged)
+ QML_NAMED_ELEMENT(ParticlePainter)
+ QML_UNCREATABLE("Abstract type. Use one of the inheriting types instead.")
+
public: // data
typedef QQuickParticleVarLengthArray<QQuickParticleGroupData::ID, 4> GroupIDs;
diff --git a/src/particles/qquickparticlesmodule.cpp b/src/particles/qquickparticlesmodule.cpp
index 03f47a3961..4f2e1cf29d 100644
--- a/src/particles/qquickparticlesmodule.cpp
+++ b/src/particles/qquickparticlesmodule.cpp
@@ -84,47 +84,45 @@ void QQuickParticlesModule::defineModule()
const char* uri = "QtQuick.Particles";
- qmlRegisterType<QQuickParticleSystem>(uri, 2, 0, "ParticleSystem");
- qmlRegisterType<QQuickParticleGroup>(uri, 2, 0, "ParticleGroup");
+ qmlRegisterTypesAndRevisions<
+ QQuickParticleSystem,
+ QQuickParticleGroup,
- qmlRegisterType<QQuickImageParticle>(uri, 2, 0, "ImageParticle");
+ QQuickImageParticle,
#if QT_CONFIG(quick_shadereffect)
- qmlRegisterType<QQuickCustomParticle>(uri, 2, 0, "CustomParticle");
+ QQuickCustomParticle,
#endif
- qmlRegisterType<QQuickItemParticle>(uri, 2, 0, "ItemParticle");
+ QQuickItemParticle,
- qmlRegisterType<QQuickParticleEmitter>(uri, 2, 0, "Emitter");
- qmlRegisterType<QQuickTrailEmitter>(uri, 2, 0, "TrailEmitter");
+ QQuickParticleEmitter,
+ QQuickTrailEmitter,
- qmlRegisterType<QQuickEllipseExtruder>(uri, 2, 0, "EllipseShape");
- qmlRegisterType<QQuickRectangleExtruder>(uri, 2, 0, "RectangleShape");
- qmlRegisterType<QQuickLineExtruder>(uri, 2, 0, "LineShape");
- qmlRegisterType<QQuickMaskExtruder>(uri, 2, 0, "MaskShape");
+ QQuickEllipseExtruder,
+ QQuickRectangleExtruder,
+ QQuickLineExtruder,
+ QQuickMaskExtruder,
- qmlRegisterType<QQuickPointDirection>(uri, 2, 0, "PointDirection");
- qmlRegisterType<QQuickAngleDirection>(uri, 2, 0, "AngleDirection");
- qmlRegisterType<QQuickTargetDirection>(uri, 2, 0, "TargetDirection");
- qmlRegisterType<QQuickCumulativeDirection>(uri, 2, 0, "CumulativeDirection");
+ QQuickPointDirection,
+ QQuickAngleDirection,
+ QQuickTargetDirection,
+ QQuickCumulativeDirection,
- qmlRegisterType<QQuickCustomAffector>(uri, 2, 0, "Affector");
- qmlRegisterType<QQuickWanderAffector>(uri, 2, 0, "Wander");
- qmlRegisterType<QQuickFrictionAffector>(uri, 2, 0, "Friction");
- qmlRegisterType<QQuickAttractorAffector>(uri, 2, 0, "Attractor");
- qmlRegisterType<QQuickGravityAffector>(uri, 2, 0, "Gravity");
- qmlRegisterType<QQuickAgeAffector>(uri, 2, 0, "Age");
- qmlRegisterType<QQuickSpriteGoalAffector>(uri, 2, 0, "SpriteGoal");
- qmlRegisterType<QQuickGroupGoalAffector>(uri, 2, 0, "GroupGoal");
- qmlRegisterType<QQuickTurbulenceAffector>(uri, 2, 0 , "Turbulence");
+ QQuickCustomAffector,
+ QQuickWanderAffector,
+ QQuickFrictionAffector,
+ QQuickAttractorAffector,
+ QQuickGravityAffector,
+ QQuickAgeAffector,
+ QQuickSpriteGoalAffector,
+ QQuickGroupGoalAffector,
+ QQuickTurbulenceAffector,
- //Exposed just for completeness
- qmlRegisterUncreatableType<QQuickParticleAffector>(uri, 2, 0, "ParticleAffector",
- QStringLiteral("Abstract type. Use one of the inheriting types instead."));
- qmlRegisterUncreatableType<QQuickParticlePainter>(uri, 2, 0, "ParticlePainter",
- QStringLiteral("Abstract type. Use one of the inheriting types instead."));
- qmlRegisterUncreatableType<QQuickParticleExtruder>(uri, 2, 0, "ParticleExtruder",
- QStringLiteral("Abstract type. Use one of the inheriting types instead."));
- qmlRegisterUncreatableType<QQuickDirection>(uri, 2, 0, "NullVector",
- QStringLiteral("Abstract type. Use one of the inheriting types instead."));
+ // Exposed just for completeness
+ QQuickParticleAffector,
+ QQuickParticlePainter,
+ QQuickParticleExtruder,
+ QQuickDirection
+ >(uri, 2);
}
QT_END_NAMESPACE
diff --git a/src/particles/qquickparticlesystem_p.h b/src/particles/qquickparticlesystem_p.h
index 1e34086b0c..dd721a7164 100644
--- a/src/particles/qquickparticlesystem_p.h
+++ b/src/particles/qquickparticlesystem_p.h
@@ -349,6 +349,7 @@ class Q_QUICKPARTICLES_PRIVATE_EXPORT QQuickParticleSystem : public QQuickItem
Q_PROPERTY(bool running READ isRunning WRITE setRunning NOTIFY runningChanged)
Q_PROPERTY(bool paused READ isPaused WRITE setPaused NOTIFY pausedChanged)
Q_PROPERTY(bool empty READ isEmpty NOTIFY emptyChanged)
+ QML_NAMED_ELEMENT(ParticleSystem)
public:
explicit QQuickParticleSystem(QQuickItem *parent = nullptr);
diff --git a/src/particles/qquickpointattractor_p.h b/src/particles/qquickpointattractor_p.h
index 47985b5e82..28bbaaa84f 100644
--- a/src/particles/qquickpointattractor_p.h
+++ b/src/particles/qquickpointattractor_p.h
@@ -62,6 +62,7 @@ class QQuickAttractorAffector : public QQuickParticleAffector
Q_PROPERTY(qreal pointY READ pointY WRITE setPointY NOTIFY pointYChanged)
Q_PROPERTY(AffectableParameters affectedParameter READ affectedParameter WRITE setAffectedParameter NOTIFY affectedParameterChanged)
Q_PROPERTY(Proportion proportionalToDistance READ proportionalToDistance WRITE setProportionalToDistance NOTIFY proportionalToDistanceChanged)
+ QML_NAMED_ELEMENT(Attractor)
public:
enum Proportion{
diff --git a/src/particles/qquickpointdirection_p.h b/src/particles/qquickpointdirection_p.h
index a80be928ad..9103a570c9 100644
--- a/src/particles/qquickpointdirection_p.h
+++ b/src/particles/qquickpointdirection_p.h
@@ -61,6 +61,7 @@ class QQuickPointDirection : public QQuickDirection
Q_PROPERTY(qreal y READ y WRITE setY NOTIFY yChanged)
Q_PROPERTY(qreal xVariation READ xVariation WRITE setXVariation NOTIFY xVariationChanged)
Q_PROPERTY(qreal yVariation READ yVariation WRITE setYVariation NOTIFY yVariationChanged)
+ QML_NAMED_ELEMENT(PointDirection)
public:
explicit QQuickPointDirection(QObject *parent = 0);
QPointF sample(const QPointF &from) override;
diff --git a/src/particles/qquickrectangleextruder_p.h b/src/particles/qquickrectangleextruder_p.h
index 630cf3050d..7c0a6c2bf1 100644
--- a/src/particles/qquickrectangleextruder_p.h
+++ b/src/particles/qquickrectangleextruder_p.h
@@ -59,6 +59,7 @@ class QQuickRectangleExtruder : public QQuickParticleExtruder
{
Q_OBJECT
Q_PROPERTY(bool fill READ fill WRITE setFill NOTIFY fillChanged)
+ QML_NAMED_ELEMENT(RectangleShape)
public:
explicit QQuickRectangleExtruder(QObject *parent = 0);
diff --git a/src/particles/qquickspritegoal_p.h b/src/particles/qquickspritegoal_p.h
index e569603550..d5f9bb88ae 100644
--- a/src/particles/qquickspritegoal_p.h
+++ b/src/particles/qquickspritegoal_p.h
@@ -63,6 +63,7 @@ class QQuickSpriteGoalAffector : public QQuickParticleAffector
Q_PROPERTY(QString goalState READ goalState WRITE setGoalState NOTIFY goalStateChanged)
Q_PROPERTY(bool jump READ jump WRITE setJump NOTIFY jumpChanged)
Q_PROPERTY(bool systemStates READ systemStates WRITE setSystemStates NOTIFY systemStatesChanged)
+ QML_NAMED_ELEMENT(SpriteGoal)
public:
explicit QQuickSpriteGoalAffector(QQuickItem *parent = 0);
diff --git a/src/particles/qquicktargetdirection_p.h b/src/particles/qquicktargetdirection_p.h
index 13e826743e..232d375d8c 100644
--- a/src/particles/qquicktargetdirection_p.h
+++ b/src/particles/qquicktargetdirection_p.h
@@ -51,6 +51,8 @@
// We mean it.
//
#include "qquickdirection_p.h"
+#include <QtQml/qqml.h>
+
QT_BEGIN_NAMESPACE
class QQuickItem;
@@ -68,6 +70,7 @@ class QQuickTargetDirection : public QQuickDirection
Q_PROPERTY(bool proportionalMagnitude READ proportionalMagnitude WRITE setProportionalMagnitude NOTIFY proprotionalMagnitudeChanged)
Q_PROPERTY(qreal magnitude READ magnitude WRITE setMagnitude NOTIFY magnitudeChanged)
Q_PROPERTY(qreal magnitudeVariation READ magnitudeVariation WRITE setMagnitudeVariation NOTIFY magnitudeVariationChanged)
+ QML_NAMED_ELEMENT(TargetDirection)
public:
explicit QQuickTargetDirection(QObject *parent = 0);
diff --git a/src/particles/qquicktrailemitter_p.h b/src/particles/qquicktrailemitter_p.h
index 22b96afd25..270bec52cf 100644
--- a/src/particles/qquicktrailemitter_p.h
+++ b/src/particles/qquicktrailemitter_p.h
@@ -64,6 +64,7 @@ class QQuickTrailEmitter : public QQuickParticleEmitter
Q_PROPERTY(QQuickParticleExtruder* emitShape READ emissonShape WRITE setEmissionShape NOTIFY emissionShapeChanged)
Q_PROPERTY(qreal emitHeight READ emitterYVariation WRITE setEmitterYVariation NOTIFY emitterYVariationChanged)
Q_PROPERTY(qreal emitWidth READ emitterXVariation WRITE setEmitterXVariation NOTIFY emitterXVariationChanged)
+ QML_NAMED_ELEMENT(TrailEmitter)
public:
enum EmitSize {
diff --git a/src/particles/qquickturbulence_p.h b/src/particles/qquickturbulence_p.h
index e73f3ba153..52011381e4 100644
--- a/src/particles/qquickturbulence_p.h
+++ b/src/particles/qquickturbulence_p.h
@@ -62,7 +62,9 @@ class QQuickTurbulenceAffector : public QQuickParticleAffector
Q_OBJECT
Q_PROPERTY(qreal strength READ strength WRITE setStrength NOTIFY strengthChanged)
Q_PROPERTY(QUrl noiseSource READ noiseSource WRITE setNoiseSource NOTIFY noiseSourceChanged)
- public:
+ QML_NAMED_ELEMENT(Turbulence)
+
+public:
explicit QQuickTurbulenceAffector(QQuickItem *parent = 0);
~QQuickTurbulenceAffector();
void affectSystem(qreal dt) override;
diff --git a/src/particles/qquickwander_p.h b/src/particles/qquickwander_p.h
index 0ad19d4d13..bf7acdacfb 100644
--- a/src/particles/qquickwander_p.h
+++ b/src/particles/qquickwander_p.h
@@ -71,6 +71,7 @@ class QQuickWanderAffector : public QQuickParticleAffector
Q_PROPERTY(qreal xVariance READ xVariance WRITE setXVariance NOTIFY xVarianceChanged)
Q_PROPERTY(qreal yVariance READ yVariance WRITE setYVariance NOTIFY yVarianceChanged)
Q_PROPERTY(AffectableParameters affectedParameter READ affectedParameter WRITE setAffectedParameter NOTIFY affectedParameterChanged)
+ QML_NAMED_ELEMENT(Wander)
public:
enum AffectableParameters {