aboutsummaryrefslogtreecommitdiffstats
path: root/src/particles/qquickcustomaffector.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-04-04 16:00:36 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-04-10 19:46:48 +0000
commit65299ce292180a845eb2d76756faeeaa1456d8f0 (patch)
treee37332324436e64d57effea735b15bac7ee23fab /src/particles/qquickcustomaffector.cpp
parent2ccd4c3672e5db2c25ca0f8df439fe8f646aa942 (diff)
Remove QQmlV4Handle
This is just an alias for QV4::ReturnedValue. We can as well use the latter. Change-Id: Ibd2c038a3ca726b39a8f0f05e02922adb9fccbdb Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/particles/qquickcustomaffector.cpp')
-rw-r--r--src/particles/qquickcustomaffector.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/particles/qquickcustomaffector.cpp b/src/particles/qquickcustomaffector.cpp
index ccb00eeba2..cadd2992b1 100644
--- a/src/particles/qquickcustomaffector.cpp
+++ b/src/particles/qquickcustomaffector.cpp
@@ -38,9 +38,9 @@
****************************************************************************/
#include "qquickcustomaffector_p.h"
-#include <private/qv8engine_p.h>
#include <private/qqmlengine_p.h>
#include <private/qqmlglobal_p.h>
+#include <private/qjsvalue_p.h>
#include <QQmlEngine>
#include <QDebug>
QT_BEGIN_NAMESPACE
@@ -103,7 +103,7 @@ QQuickCustomAffector::QQuickCustomAffector(QQuickItem *parent) :
bool QQuickCustomAffector::isAffectConnected()
{
- IS_SIGNAL_CONNECTED(this, QQuickCustomAffector, affectParticles, (QQmlV4Handle,qreal));
+ IS_SIGNAL_CONNECTED(this, QQuickCustomAffector, affectParticles, (const QJSValue &, qreal));
}
void QQuickCustomAffector::affectSystem(qreal dt)
@@ -156,23 +156,26 @@ void QQuickCustomAffector::affectSystem(qreal dt)
for (int i=0; i<toAffect.size(); i++)
array->put(i, (v = toAffect[i]->v4Value(m_system)));
- if (dt >= simulationCutoff || dt <= simulationDelta) {
+ const auto doAffect = [&](qreal dt) {
affectProperties(toAffect, dt);
- emit affectParticles(QQmlV4Handle(array), dt);
+ QJSValue particles;
+ QJSValuePrivate::setValue(&particles, v4, array);
+ emit affectParticles(particles, dt);
+ };
+
+ if (dt >= simulationCutoff || dt <= simulationDelta) {
+ doAffect(dt);
} else {
int realTime = m_system->timeInt;
m_system->timeInt -= dt * 1000.0;
while (dt > simulationDelta) {
m_system->timeInt += simulationDelta * 1000.0;
dt -= simulationDelta;
- affectProperties(toAffect, simulationDelta);
- emit affectParticles(QQmlV4Handle(array), simulationDelta);
+ doAffect(simulationDelta);
}
m_system->timeInt = realTime;
- if (dt > 0.0) {
- affectProperties(toAffect, dt);
- emit affectParticles(QQmlV4Handle(array), dt);
- }
+ if (dt > 0.0)
+ doAffect(dt);
}
foreach (QQuickParticleData* d, toAffect)