diff options
Diffstat (limited to 'src/particles/qquickgravity.cpp')
-rw-r--r-- | src/particles/qquickgravity.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/src/particles/qquickgravity.cpp b/src/particles/qquickgravity.cpp index 90f305f336..a2a2ad7e0e 100644 --- a/src/particles/qquickgravity.cpp +++ b/src/particles/qquickgravity.cpp @@ -37,6 +37,7 @@ ** ****************************************************************************/ +#include <QtQml/qqmlinfo.h> #include "qquickgravity_p.h" #include <cmath> QT_BEGIN_NAMESPACE @@ -64,16 +65,51 @@ const qreal CONV = 0.017453292520444443; Pixels per second that objects will be accelerated by. */ +void QQuickGravityAffector::setMagnitude(qreal arg) +{ + if (m_magnitude != arg) { + m_magnitude = arg; + m_needRecalc = true; + emit magnitudeChanged(arg); + } +} + +qreal QQuickGravityAffector::magnitude() const +{ + return m_magnitude; +} + + /*! \qmlproperty real QtQuick.Particles::Gravity::acceleration + \deprecated - Name changed to magnitude, will be removed soon. + \warning The name for this property has changed to magnitude, use it instead. */ +void QQuickGravityAffector::setAcceleration(qreal arg) +{ + qmlWarning(this) << "The acceleration property is deprecated. Please use magnitude instead."; + setMagnitude(arg); +} + /*! \qmlproperty real QtQuick.Particles::Gravity::angle Angle of acceleration. */ +void QQuickGravityAffector::setAngle(qreal arg) +{ + if (m_angle != arg) { + m_angle = arg; + m_needRecalc = true; + emit angleChanged(arg); + } +} + +qreal QQuickGravityAffector::angle() const +{ + return m_angle; +} QQuickGravityAffector::QQuickGravityAffector(QQuickItem *parent) : QQuickParticleAffector(parent), m_magnitude(-10), m_angle(90), m_needRecalc(true) @@ -94,4 +130,7 @@ bool QQuickGravityAffector::affectParticle(QQuickParticleData *d, qreal dt) d->setInstantaneousVY(d->curVY(m_system) + m_dy*dt, m_system); return true; } + + + QT_END_NAMESPACE |